CGPdocs

opengl_fbo_structure

Off-screen frame buffer, to render into a texture (color or depth).

module 13_openglsource: fbo.hpp

Fields and methods

Members of the struct opengl_fbo_structure. Most of what you do with a CGP type goes through the free functions listed below.

Fields

opengl_fbo_mode mode = opengl_fbo_mode::imageContent of the FBO, image (RGB8 color texture plus a depth renderbuffer, default) or depth (depth texture only).
GLuint id = 0OpenGL id of the framebuffer, 0 when not initialized.
GLuint depth_buffer_id = 0OpenGL id of the depth renderbuffer used in image mode, 0 otherwise.
opengl_texture_image_structure textureTexture receiving the rendering, color in image mode or depth in depth mode, to be bound for sampling after unbind.
int width = 0Width in pixels of the FBO and of its texture, 800 if not set before initialize.
int height = 0Height in pixels of the FBO and of its texture, 800 if not set before initialize.
GLuint emscripten_color_attachment_id = 0OpenGL id of the dummy color texture attached in depth mode under Emscripten, since WebGL requires a complete FBO.
GLint viewport_backup = {0, 0, 0, 0}Viewport (x, y, width, height) saved by bind and restored by unbind.

Methods

Creates the framebuffer and its texture (and depth renderbuffer in image mode) at size width x height, or 800x800 if unset, and stops the program if the framebuffer is incomplete. src
Saves the current viewport, binds the framebuffer and sets the viewport to its size so that the next draw calls render into texture. src
Binds the default framebuffer back and restores the viewport saved by bind. src
Reallocates the texture (and depth renderbuffer) at the new size when it differs from the current one, discarding their content. src
Deletes the framebuffer, the depth renderbuffer, the texture and the Emscripten dummy texture, and sets width and height to 0. src

Functions taking a opengl_fbo_structure

None.

Functions returning a opengl_fbo_structure

None.

Operators

None.

CGP - Computer Graphics Programming.