cgv
|
this class encapsulate render buffers that live on the GPU which must support frame buffer objects for this to work. More...
#include <render_buffer.h>
Public Member Functions | |
render_buffer (const std::string &description="[R,G,B,A]") | |
construct from description of component format, where the default format specifies a color buffer with alpha channel | |
void | set_nr_multi_samples (unsigned _nr_samples) |
set the number of multi samples, which should be done before create | |
void | destruct (const context &ctx) |
destruct the render buffer | |
bool | create (const context &ctx, int width=-1, int height=-1) |
create a render buffer. | |
bool | is_created () const override |
check whether the buffer has been created | |
~render_buffer () | |
calls the destruct method if necessary | |
int | get_width () const |
return the width in pixels of the buffer | |
int | get_height () const |
return the height in pixels of the buffer | |
bool | is_multi_buffer () const |
whether this buffer is a multi sample buffer | |
unsigned | get_nr_multi_samples () const |
return number of multi samples | |
bool | is_depth_buffer () const |
return whether the component format corresponds to a depth buffer format | |
bool | is_color_buffer () const |
return whether the component format corresponds to a color buffer format | |
![]() | |
render_component () | |
initialize members | |
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 | |
![]() | |
component_format (const std::string &description) | |
construct from description string, see set_component_format for docu | |
bool | set_component_format (const std::string &description) |
set component format from description string, which has the following syntax. | |
void | set_components (const std::string &_components) |
comma separated list of component descriptors, for example "R,G,B" | |
component_format (cgv::type::info::TypeId _component_type=cgv::type::info::TypeId::TI_UNDEF, const std::string &_component_name_list="", unsigned align=1, unsigned d0=0, unsigned d1=0, unsigned d2=0, unsigned d3=0) | |
construct component format from component type, comma or colon separated list of component names, component alignment and bit depths for packed formats | |
component_format (cgv::type::info::TypeId _component_type, ComponentFormat cf, unsigned align=1, unsigned d0=0, unsigned d1=0, unsigned d2=0, unsigned d3=0) | |
construct component format from component type, standard component format, component alignment and bit depths for packed formats | |
void | set_integer_interpretation (ComponentIntegerInterpretation cii) |
set the integer interpretation | |
ComponentIntegerInterpretation | get_integer_interpretation () const |
return current integer interpretation | |
template<typename T > | |
T | get (int ci, const void *ptr) const |
constant access to the i-th component stored at the given location | |
template<typename T > | |
bool | set (int ci, void *ptr, const T &v) const |
write access to the i-th component, return whether write was successful | |
bool | empty () const |
return whether the component format is defined | |
void | clear () |
clear the component format | |
const packing_info & | get_packing_info () const |
return the packing info by simple conversion of the this pointer | |
void | set_packing_info (const packing_info &pi) |
set packing info by simply assigning to a converted this pointer | |
unsigned int | get_nr_components () const |
return the number of components | |
unsigned int | get_component_index (const std::string &name) const |
return the index of a component given by name or -1 if not found | |
std::string | get_component_name (unsigned int i) const |
return the name of the component with index i | |
ComponentFormat | get_standard_component_format () const |
return whether the component format is one of the standard formats | |
void | set_component_names (const std::string &_component_name_list) |
set component names from a comma or colon separated list of names | |
void | set_component_format (ComponentFormat _cf) |
set the component names from a standard component format | |
cgv::type::info::TypeId | get_component_type () const |
return the component type | |
void | set_component_type (cgv::type::info::TypeId _type_id) |
set the component type | |
unsigned int | get_entry_size () const |
return the size of one entry of components in bytes | |
bool | operator== (const component_format &cf) const |
comparison between component formats | |
bool | operator!= (const component_format &cf) const |
comparison between component formats | |
![]() | |
packing_info (unsigned align=1, unsigned d0=0, unsigned d1=0, unsigned d2=0, unsigned d3=0) | |
construct packing information from alignment and bit depths. | |
void | clear () |
clear packing info information | |
unsigned | get_bit_depth (unsigned ci) const |
return the bit depth of the ci-th component | |
void | set_bit_depth (unsigned ci, unsigned depth) |
set the bit depth of the ci-th component | |
bool | is_packing () const |
return whether packing is enabled | |
void | set_packing (bool enable=true) |
set the packing flag | |
unsigned int | get_component_alignment () const |
return the component alignment in bits in the packed case and in bytes in the unpacked case | |
void | set_component_alignment (unsigned a) |
set the component alignment in bits in the packed case and in bytes in the unpacked case | |
int | get_signed (unsigned ci, const void *ptr) const |
return the ci-th component of the data entry pointed to by the given pointer of a signed packed component | |
unsigned int | get_unsigned (unsigned ci, const void *ptr) const |
return the ci-th component of the data entry pointed to by the given pointer of an unsigned packed component | |
bool | set_signed (unsigned ci, void *ptr, int v) const |
set the ci-th component of the data entry pointed to by the given pointer of a signed packed component | |
bool | set_unsigned (unsigned ci, void *ptr, unsigned v) const |
set the ci-th component of the data entry pointed to by the given pointer of an unsigned packed component | |
bool | operator== (const packing_info &pi) const |
equal comparison | |
bool | operator!= (const packing_info &pi) const |
unequal comparison | |
Public Attributes | |
std::string | last_error |
a string that contains the last error | |
![]() | |
unsigned | nr_multi_samples = 0 |
![]() | |
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 | |
![]() | |
static const std::string & | get_last_error () |
returns an error string after parsing of description string has failed | |
![]() | |
static size_t | align (size_t v, unsigned a) |
return the next integer larger or equal to v which is dividable by a | |
![]() | |
void | extract_components () |
extract components from component string | |
![]() | |
bool | prepare_bit_operation (unsigned ci, void *ptr, unsigned &off, unsigned &bd, unsigned *&iptr) const |
bool | prepare_bit_operation (unsigned ci, const void *ptr, unsigned &off, unsigned &bd, const unsigned *&iptr) const |
unsigned int | get_bit_offset (unsigned ci) const |
![]() | |
cgv::type::info::TypeId | component_type |
store the type id of the component type | |
ComponentIntegerInterpretation | component_interpretation |
interpretation of integer typed components | |
std::string | component_string |
store all component names in one string separated with 0-chars | |
std::vector< unsigned short > | component_positions |
store the position of each component in the component string | |
![]() | |
bool | is_packed: 1 |
unsigned | bd0: 6 |
unsigned | bd1: 6 |
unsigned | bd2: 6 |
unsigned | bd3: 6 |
unsigned | ca: 6 |
![]() | |
static std::string | last_error |
store the last error that appeared during parsing of a description | |
this class encapsulate render buffers that live on the GPU which must support frame buffer objects for this to work.
Definition at line 13 of file render_buffer.h.
cgv::render::render_buffer::render_buffer | ( | const std::string & | description = "[R,G,B,A]" | ) |
construct from description of component format, where the default format specifies a color buffer with alpha channel
Definition at line 6 of file render_buffer.cxx.
cgv::render::render_buffer::~render_buffer | ( | ) |
calls the destruct method if necessary
Definition at line 19 of file render_buffer.cxx.
References cgv::render::render_component::ctx_ptr, and destruct().
bool cgv::render::render_buffer::create | ( | const context & | ctx, |
int | width = -1 , |
||
int | height = -1 |
||
) |
create a render buffer.
If no extent is specified it is copied from the current viewport.
Definition at line 41 of file render_buffer.cxx.
References cgv::render::render_component::ctx_ptr, and destruct().
Referenced by cgv::render::texture::write_to_file().
void cgv::render::render_buffer::destruct | ( | const context & | ctx | ) |
destruct the render buffer
Definition at line 29 of file render_buffer.cxx.
Referenced by create(), and ~render_buffer().
|
inline |
return the height in pixels of the buffer
Definition at line 37 of file render_buffer.h.
|
inline |
return number of multi samples
Definition at line 41 of file render_buffer.h.
|
inline |
return the width in pixels of the buffer
Definition at line 35 of file render_buffer.h.
bool cgv::render::render_buffer::is_color_buffer | ( | ) | const |
return whether the component format corresponds to a color buffer format
Definition at line 59 of file render_buffer.cxx.
References cgv::data::CF_RGB, cgv::data::CF_RGBA, and cgv::data::component_format::get_standard_component_format().
|
overridevirtual |
check whether the buffer has been created
Reimplemented from cgv::render::render_component.
Definition at line 36 of file render_buffer.cxx.
bool cgv::render::render_buffer::is_depth_buffer | ( | ) | const |
return whether the component format corresponds to a depth buffer format
Definition at line 54 of file render_buffer.cxx.
References cgv::data::CF_D, and cgv::data::component_format::get_standard_component_format().
Referenced by cgv::render::frame_buffer::attach().
|
inline |
whether this buffer is a multi sample buffer
Definition at line 39 of file render_buffer.h.
void cgv::render::render_buffer::set_nr_multi_samples | ( | unsigned | _nr_samples | ) |
set the number of multi samples, which should be done before create
Definition at line 14 of file render_buffer.cxx.
|
mutable |