cgv
|
this class encapsulate frame buffers that live on the GPU and can be used as destination for the render process. More...
#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 if extension is supported, otherwise return false. | |
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 | |
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) |
enable the framebuffer either with all color attachments if no arguments are given or if arguments are given with the indexed color attachments. | |
bool | enable (context &ctx, std::vector< int > &indices) |
enable the framebuffer either with the color attachments specified in the given vector. | |
void | push_viewport (context &ctx, const dvec2 &depth_range=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 | |
void | blit_to (context &ctx, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const |
different variants of blitting rectangle src_rect of this frame buffer into rectangle dest_rect of destination frame buffer | |
void | blit_to (context &ctx, const ivec4 &src_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const |
void | blit_to (context &ctx, const ivec4 &src_rect, const ivec4 &dst_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const |
void | blit_to (context &ctx, frame_buffer &dst_fbo, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const |
void | blit_to (context &ctx, frame_buffer &dst_fbo, const ivec4 &src_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const |
void | blit_to (context &ctx, frame_buffer &dst_fbo, const ivec4 &src_rect, const ivec4 &dst_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) const |
void | blit_from (context &ctx, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) |
different variants of blitting to rectangle dst_rect of this frame buffer from rectangle src_rect of source frame buffer | |
void | blit_from (context &ctx, const ivec4 &dst_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) |
void | blit_from (context &ctx, const ivec4 &dst_rect, const ivec4 &src_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) |
void | blit_from (context &ctx, frame_buffer &src_fbo, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) |
void | blit_from (context &ctx, frame_buffer &src_fbo, const ivec4 &dst_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) |
void | blit_from (context &ctx, frame_buffer &src_fbo, const ivec4 &dst_rect, const ivec4 &src_rect, BufferTypeBits btbs=BTB_ALL_BITS, bool interpolate=false) |
![]() | |
frame_buffer_base () | |
initialize members | |
![]() | |
render_component () | |
initialize members | |
virtual bool | is_created () const |
return whether component has been created | |
void | put_id_void (void *ptr) const |
copy the rendering api specific id the component to the memory location of the given pointer. | |
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 | |
![]() | |
void * | handle |
void * | internal_format |
void * | user_data |
const context * | ctx_ptr |
keep pointer to my context | |
std::string | last_error |
a string that contains the last error | |
Additional Inherited Members | |
![]() | |
bool | is_enabled |
std::vector< int > | enabled_color_attachments |
bool | depth_attached |
bool | attached [16] |
int | width |
int | height |
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.
Definition at line 16 of file frame_buffer.h.
cgv::render::frame_buffer::frame_buffer | ( | ) |
constructor just initializes stuff
Definition at line 6 of file frame_buffer.cxx.
cgv::render::frame_buffer::~frame_buffer | ( | ) |
destructor
Definition at line 33 of file frame_buffer.cxx.
References cgv::render::render_component::ctx_ptr, and destruct().
bool cgv::render::frame_buffer::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
Definition at line 82 of file frame_buffer.cxx.
References cgv::render::render_buffer::is_depth_buffer().
Referenced by cgv::render::gl::gl_transparent_renderer::create_and_attach_texture(), vr_test::init_frame(), cgv::render::gl::render_to_texture3D(), and cgv::render::texture::write_to_file().
bool cgv::render::frame_buffer::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
Definition at line 88 of file frame_buffer.cxx.
References cgv::data::CF_D, cgv::render::texture::ensure_state(), cgv::data::data_format::get_nr_dimensions(), cgv::data::component_format::get_standard_component_format(), and last_error.
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
Definition at line 99 of file frame_buffer.cxx.
References cgv::data::CF_D, cgv::render::texture::ensure_state(), cgv::data::data_format::get_nr_dimensions(), cgv::data::component_format::get_standard_component_format(), and last_error.
|
inline |
different variants of blitting to rectangle dst_rect of this frame buffer from rectangle src_rect of source frame buffer
Definition at line 78 of file frame_buffer.h.
References blit_from().
Referenced by blit_from().
|
inline |
Definition at line 79 of file frame_buffer.h.
void cgv::render::frame_buffer::blit_from | ( | context & | ctx, |
const ivec4 & | dst_rect, | ||
const ivec4 & | src_rect, | ||
BufferTypeBits | btbs = BTB_ALL_BITS , |
||
bool | interpolate = false |
||
) |
Definition at line 22 of file frame_buffer.cxx.
|
inline |
Definition at line 81 of file frame_buffer.h.
|
inline |
Definition at line 82 of file frame_buffer.h.
void cgv::render::frame_buffer::blit_from | ( | context & | ctx, |
frame_buffer & | src_fbo, | ||
const ivec4 & | dst_rect, | ||
const ivec4 & | src_rect, | ||
BufferTypeBits | btbs = BTB_ALL_BITS , |
||
bool | interpolate = false |
||
) |
Definition at line 27 of file frame_buffer.cxx.
|
inline |
different variants of blitting rectangle src_rect of this frame buffer into rectangle dest_rect of destination frame buffer
Definition at line 71 of file frame_buffer.h.
References blit_to().
Referenced by blit_to().
|
inline |
Definition at line 72 of file frame_buffer.h.
void cgv::render::frame_buffer::blit_to | ( | context & | ctx, |
const ivec4 & | src_rect, | ||
const ivec4 & | dst_rect, | ||
BufferTypeBits | btbs = BTB_ALL_BITS , |
||
bool | interpolate = false |
||
) | const |
Definition at line 12 of file frame_buffer.cxx.
|
inline |
Definition at line 74 of file frame_buffer.h.
|
inline |
Definition at line 75 of file frame_buffer.h.
void cgv::render::frame_buffer::blit_to | ( | context & | ctx, |
frame_buffer & | dst_fbo, | ||
const ivec4 & | src_rect, | ||
const ivec4 & | dst_rect, | ||
BufferTypeBits | btbs = BTB_ALL_BITS , |
||
bool | interpolate = false |
||
) | const |
Definition at line 17 of file frame_buffer.cxx.
bool cgv::render::frame_buffer::create | ( | const context & | ctx, |
int | _width = -1 , |
||
int | _height = -1 |
||
) |
create framebuffer if extension is supported, otherwise return false.
create framebuffer of 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.
Definition at line 51 of file frame_buffer.cxx.
References cgv::render::render_component::ctx_ptr, and destruct().
Referenced by vr_test::init_frame(), cgv::render::gl::gl_transparent_renderer::init_frame(), cgv::render::gl::render_to_texture3D(), and cgv::render::texture::write_to_file().
void cgv::render::frame_buffer::destruct | ( | const context & | ctx | ) |
destruct the framebuffer objext
Definition at line 44 of file frame_buffer.cxx.
Referenced by create(), cgv::render::gl::gl_transparent_renderer::destruct(), vr_test::init_frame(), cgv::render::gl::gl_transparent_renderer::init_frame(), and ~frame_buffer().
bool cgv::render::frame_buffer::disable | ( | context & | ctx | ) |
disable the framebuffer object
Definition at line 183 of file frame_buffer.cxx.
Referenced by vr_test::init_frame(), cgv::render::gl::render_to_texture3D(), cgv::render::gl::gl_transparent_renderer::render_transparent(), and cgv::render::texture::write_to_file().
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.
Definition at line 121 of file frame_buffer.cxx.
Referenced by vr_test::init_frame(), cgv::render::gl::render_to_texture3D(), cgv::render::gl::gl_transparent_renderer::render_transparent(), and cgv::render::texture::write_to_file().
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.
Definition at line 162 of file frame_buffer.cxx.
|
inline |
return the height
Definition at line 44 of file frame_buffer.h.
Referenced by cgv::render::gl::gl_transparent_renderer::init_frame(), and push_viewport().
|
static |
return the maximum number of color attachments supported by the GPU
Definition at line 188 of file frame_buffer.cxx.
|
static |
return the maximum number of simultaneous draw buffers supported by the GPU
Definition at line 193 of file frame_buffer.cxx.
|
inline |
return the width
Definition at line 42 of file frame_buffer.h.
Referenced by vr_test::init_frame(), cgv::render::gl::gl_transparent_renderer::init_frame(), and push_viewport().
bool cgv::render::frame_buffer::is_complete | ( | const context & | ctx | ) | const |
check for completeness, if not complete, get the reason in last_error
Definition at line 113 of file frame_buffer.cxx.
Referenced by vr_test::init_frame(), cgv::render::gl::gl_transparent_renderer::init_frame(), cgv::render::gl::render_to_texture3D(), and cgv::render::texture::write_to_file().
void cgv::render::frame_buffer::pop_viewport | ( | context & | ctx | ) |
recover the window transformation array active before the last call to push_viewport
Definition at line 177 of file frame_buffer.cxx.
References cgv::render::context::pop_window_transformation_array().
Referenced by vr_test::init_frame().
void cgv::render::frame_buffer::push_viewport | ( | context & | ctx, |
const dvec2 & | depth_range = dvec2(0,1) |
||
) |
push a new window transformation to cover the fbo onto the window transformation stack
Definition at line 169 of file frame_buffer.cxx.
References get_height(), get_width(), cgv::render::context::push_window_transformation_array(), cgv::render::context::set_depth_range(), and cgv::render::context::set_viewport().
Referenced by vr_test::init_frame().
void cgv::render::frame_buffer::set_height | ( | int | _height | ) |
set a different height
Definition at line 69 of file frame_buffer.cxx.
void cgv::render::frame_buffer::set_size | ( | int | _width, |
int | _height | ||
) |
set different size
Definition at line 75 of file frame_buffer.cxx.
void cgv::render::frame_buffer::set_width | ( | int | _width | ) |
set a different width
Definition at line 64 of file frame_buffer.cxx.
|
mutable |
a string that contains the last error, which is only set by the init method
Definition at line 24 of file frame_buffer.h.
Referenced by attach(), attach(), and cgv::render::texture::write_to_file().