cgv
|
#include <frame_buffer.h>
Public Member Functions | |
frame_buffer () | |
constructor just initializes stuff | |
~frame_buffer () | |
destructor | |
void | destruct (const context &ctx) |
destruct the framebuffer objext | |
bool | create (const context &ctx, int _width=-1, int _height=-1) |
create framebuffer of extension is supported, otherwise return false. More... | |
void | set_width (int _width) |
set a different width | |
void | set_height (int _height) |
set a different height | |
void | set_size (int _width, int _height) |
set different size | |
int | get_width () const |
return the width | |
int | get_height () const |
return the height | |
bool | attach (const context &ctx, const render_buffer &rb, int i=0) |
attach render buffer to depth buffer if it is a depth buffer, to stencil if it is a stencil buffer or to the i-th color attachment if it is a color buffer | |
bool | attach (const context &ctx, const texture &tex2d, int level=0, int i=0) |
attach 2d texture to depth buffer if it is a depth texture, to stencil if it is a stencil texture or to the i-th color attachment if it is a color texture | |
bool | attach (const context &ctx, const texture &tex3d, int z_or_cube_side, int level, int i) |
attach the j-th slice of a 3d texture or the given cube side of a cubemap to the i-th color attachment More... | |
bool | is_complete (const context &ctx) const |
check for completeness, if not complete, get the reason in last_error | |
bool | enable (context &ctx, int i0=-1, int i1=-1, int i2=-1, int i3=-1, int i4=-1, int i5=-1, int i6=-1, int i7=-1, int i8=-1, int i9=-1, int i10=-1, int i11=-1, int i12=-1, int i13=-1, int i14=-1, int i15=-1) |
bool | enable (context &ctx, std::vector< int > &indices) |
void | push_viewport (context &ctx, const cgv::render::render_types::dvec2 &depth_range=cgv::render::render_types::dvec2(0, 1)) |
push a new window transformation to cover the fbo onto the window transformation stack | |
void | pop_viewport (context &ctx) |
recover the window transformation array active before the last call to push_viewport | |
bool | disable (context &ctx) |
disable the framebuffer object | |
virtual bool | is_created () const |
return whether component has been created | |
void | put_id_void (void *ptr) const |
template<typename T > | |
void | put_id (T &id) const |
cast the refence to rendering api specific representation of component id to the specified type | |
Static Public Member Functions | |
static int | get_max_nr_color_attachments (const context &ctx) |
return the maximum number of color attachments supported by the GPU | |
static int | get_max_nr_draw_buffers (const context &ctx) |
return the maximum number of simultaneous draw buffers supported by the GPU | |
Public Attributes | |
std::string | last_error |
a string that contains the last error, which is only set by the init method | |
const context * | ctx_ptr |
keep pointer to my context | |
this class encapsulate frame buffers that live on the GPU and can be used as destination for the render process. The GPU must support frame buffer objects for this to work.
bool cgv::render::frame_buffer::attach | ( | const context & | ctx, |
const texture & | tex3d, | ||
int | z_or_cube_side, | ||
int | level, | ||
int | i | ||
) |
attach the j-th slice of a 3d texture or the given cube side of a cubemap to the i-th color attachment
attach the j-th slice of a 3d texture to the i-th color attachment
bool cgv::render::frame_buffer::create | ( | const context & | ctx, |
int | _width = -1 , |
||
int | _height = -1 |
||
) |
create framebuffer of extension is supported, otherwise return false.
create framebuffer if extension is supported, otherwise return false. The set extent is used to set the viewport in the enable method. If no extent is specified it is copied from glViewport.
bool cgv::render::frame_buffer::enable | ( | context & | ctx, |
int | i0 = -1 , |
||
int | i1 = -1 , |
||
int | i2 = -1 , |
||
int | i3 = -1 , |
||
int | i4 = -1 , |
||
int | i5 = -1 , |
||
int | i6 = -1 , |
||
int | i7 = -1 , |
||
int | i8 = -1 , |
||
int | i9 = -1 , |
||
int | i10 = -1 , |
||
int | i11 = -1 , |
||
int | i12 = -1 , |
||
int | i13 = -1 , |
||
int | i14 = -1 , |
||
int | i15 = -1 |
||
) |
enable the framebuffer either with all color attachments if no arguments are given or if arguments are given with the indexed color attachments. Return whether this was successful.
bool cgv::render::frame_buffer::enable | ( | context & | ctx, |
std::vector< int > & | indices | ||
) |
enable the framebuffer either with the color attachments specified in the given vector.
|
inherited |
copy the rendering api specific id the component to the memory location of the given pointer. For opengl this the passed pointer should be of type GLint or GLuint.