UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
Framebuffer Class Reference

#include <opengl_utils.hpp>

Collaboration diagram for Framebuffer:
Collaboration graph

Public Member Functions

 Framebuffer ()
 
 Framebuffer (const Framebuffer &)=delete
 
 Framebuffer (Framebuffer &&o)
 
 ~Framebuffer ()
 
void attach_texture (const Texture &tex)
 
void attach_texture (GLuint tex)
 
GLuint get ()
 
Framebuffer & operator= (const Framebuffer &)=delete
 
Framebuffer & operator= (Framebuffer &&o)
 

Public Attributes

Fb_handle_uniq handle
 
uint32_t height = 0
 
Fb_id_uniq id
 
MemoryMapping map
 
uint32_t pitch = 0
 
uint32_t pix_fmt = 0
 
size_t size = 0
 
uint32_t width = 0
 

Private Member Functions

void swap (Framebuffer &o)
 

Private Attributes

GLuint fbo = 0
 

Detailed Description

RAII wrapper for an OpenGL framebuffer object

Definition at line 332 of file drm.cpp.

Constructor & Destructor Documentation

◆ Framebuffer() [1/3]

Framebuffer::Framebuffer ( )
inline

Constructs a new framebuffer object

Definition at line 213 of file opengl_utils.hpp.

213 {
214 glGenFramebuffers(1, &fbo);
215 }

References fbo.

◆ ~Framebuffer()

Framebuffer::~Framebuffer ( )
inline

Definition at line 217 of file opengl_utils.hpp.

217 {
218 glDeleteFramebuffers(1, &fbo);
219 }

References fbo.

◆ Framebuffer() [2/3]

Framebuffer::Framebuffer ( const Framebuffer & )
delete

◆ Framebuffer() [3/3]

Framebuffer::Framebuffer ( Framebuffer && o)
inline

Definition at line 222 of file opengl_utils.hpp.

222{ swap(o); }
void swap(Framebuffer &o)

References swap().

Here is the call graph for this function:

Member Function Documentation

◆ attach_texture() [1/2]

void Framebuffer::attach_texture ( const Texture & tex)
inline

Attaches a texture to the contained framebuffer

Parameters
texTexture object containg the texture to attach

Definition at line 243 of file opengl_utils.hpp.

243 {
244 attach_texture(tex.get());
245 }
GLuint get() const
void attach_texture(GLuint tex)

References attach_texture(), and Texture::get().

Here is the call graph for this function:

◆ attach_texture() [2/2]

void Framebuffer::attach_texture ( GLuint tex)

Attaches a texture to the contained framebuffer

Parameters
texId of texture to attach

Definition at line 306 of file opengl_utils.cpp.

306 {
307 glBindTexture(GL_TEXTURE_2D, tex);
308 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
309 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
310 glBindTexture(GL_TEXTURE_2D, 0);
311
312
313 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
314 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
315 if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE){
316 printf("Error %d\n", glGetError());
317 }
318 glBindFramebuffer(GL_FRAMEBUFFER, 0);
319}

References fbo.

Referenced by attach_texture().

◆ get()

GLuint Framebuffer::get ( )
inline

Returns the underlying OpenGL framebuffer id

Definition at line 229 of file opengl_utils.hpp.

229{ return fbo; }

References fbo.

◆ operator=() [1/2]

Framebuffer & Framebuffer::operator= ( const Framebuffer & )
delete

◆ operator=() [2/2]

Framebuffer & Framebuffer::operator= ( Framebuffer && o)
inline

Definition at line 224 of file opengl_utils.hpp.

224{ swap(o); return *this; }

References swap().

Here is the call graph for this function:

◆ swap()

void Framebuffer::swap ( Framebuffer & o)
inlineprivate

Definition at line 248 of file opengl_utils.hpp.

248 {
249 std::swap(fbo, o.fbo);
250 }

References fbo.

Referenced by Framebuffer(), and operator=().

Member Data Documentation

◆ fbo

GLuint Framebuffer::fbo = 0
private

Definition at line 252 of file opengl_utils.hpp.

Referenced by Framebuffer(), ~Framebuffer(), attach_texture(), get(), and swap().

◆ handle

Fb_handle_uniq Framebuffer::handle

Definition at line 338 of file drm.cpp.

Referenced by create_dumb_fb().

◆ height

uint32_t Framebuffer::height = 0

Definition at line 334 of file drm.cpp.

Referenced by create_dumb_fb(), and draw_frame().

◆ id

Fb_id_uniq Framebuffer::id

Definition at line 342 of file drm.cpp.

Referenced by create_dumb_fb(), draw_splash(), and swap_buffers().

◆ map

MemoryMapping Framebuffer::map

Definition at line 343 of file drm.cpp.

Referenced by create_dumb_fb(), and draw_frame().

◆ pitch

uint32_t Framebuffer::pitch = 0

Definition at line 335 of file drm.cpp.

Referenced by create_dumb_fb(), and draw_frame().

◆ pix_fmt

uint32_t Framebuffer::pix_fmt = 0

Definition at line 340 of file drm.cpp.

◆ size

size_t Framebuffer::size = 0

Definition at line 336 of file drm.cpp.

Referenced by create_dumb_fb().

◆ width

uint32_t Framebuffer::width = 0

Definition at line 333 of file drm.cpp.

Referenced by create_dumb_fb(), and draw_frame().


The documentation for this class was generated from the following files: