cgv
|
the attribute_array_binding allows to define vertex attributes (i.e. More...
#include <attribute_array_binding.h>
static interface is used to access global attribute arrays of context | |
static bool | is_global_array_enabled (const context &ctx, int loc) |
check whether an attribute array is enabled | |
static bool | enable_global_array (const context &ctx, int loc) |
enable attribute array of given location | |
static bool | disable_global_array (const context &ctx, int loc) |
disable attribute array of given location | |
static bool | set_global_attribute_array (const context &ctx, int loc, const vertex_buffer &vbo, type_descriptor td, size_t size, size_t offset, unsigned stride=0) |
point array of vertex attribute at location loc to vertex buffer array array stored in CPU memory; in case of success also enable vertex attribute array | |
template<typename T > | |
static bool | set_global_attribute_array (const context &ctx, int loc, const T &array) |
point array of vertex attribute at location loc to array array stored in CPU memory; in case of success also enable vertex attribute array | |
template<typename T > | |
static bool | set_global_attribute_array (const context &ctx, int loc, const T *array_ptr, size_t nr_elements, unsigned stride=0) |
point array of vertex attribute at location loc to array with nr_elements elements pointed to by array_ptr in CPU memory; in case of success also enable vertex attribute array | |
static bool | set_global_attribute_array (const context &ctx, int loc, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0) |
point array of vertex attribute at location loc to elements of given type in vertex buffer object at given offset spaced with given stride; in case of success also enable vertex attribute array | |
static bool | set_global_element_array (const context &ctx, const vertex_buffer &vbe) |
set the global elment array to the given vertex buffer object which must me of type VBT_INDICES | |
attribute_array_binding () | |
default constructor does not create attribute array binding | |
~attribute_array_binding () | |
destruct attribute array binding object | |
bool | create (const context &ctx) |
create the attribute array binding object | |
void | destruct (const context &ctx) |
destruct attribute array binding object | |
bool | enable (context &ctx) |
enable whole the attribute array binding object | |
bool | disable (context &ctx) |
disable whole attribute array binding object | |
bool | enable_array (const context &ctx, int loc) |
enable array for vertex attribute at location loc | |
bool | is_array_enabled (const context &ctx, int loc) const |
check if array of vertex attribute at location loc is enabled | |
bool | disable_array (const context &ctx, int loc) |
disable array for attribute at location loc | |
template<typename T > | |
bool | set_attribute_array (const context &ctx, int loc, const T &array) |
set vertex attribute location to given array and enable array | |
template<typename T > | |
bool | set_attribute_array (const context &ctx, int loc, const T *value_ptr, unsigned nr_elements, unsigned stride=0) |
set a vertex attribute to a single value or an array of values through the cgv::math::vec or std::vector classes. | |
bool | set_attribute_array (const context &ctx, int loc, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0) |
point array of vertex attribute at location loc to elements of given type in vertex buffer object at given offset spaced with given stride; in case of success also enable vertex attribute array | |
template<typename T > | |
bool | bind_attribute_array (const context &ctx, const shader_program &prog, const std::string &attribute_name, const T &array) |
convenience function that determines attribute location in program by name and then uses set_attribute_array to set vertex attribute location to given array and enable array | |
template<typename T > | |
bool | bind_attribute_array (const context &ctx, const shader_program &prog, const std::string &attribute_name, const T *value_ptr, unsigned nr_elements, unsigned stride=0) |
convenience function that determines attribute location in program by name and then uses set_attribute_array to set a vertex attribute to a single value or an array of values through the cgv::math::vec or std::vector classes. | |
bool | bind_attribute_array (const context &ctx, const shader_program &prog, const std::string &attribute_name, type_descriptor element_type, const vertex_buffer &vbo, size_t offset_in_bytes, size_t nr_elements, unsigned stride_in_bytes=0) |
convenience function that determines attribute location in program by name and then uses set_attribute_array to point array of vertex attribute at location loc to elements of given type in vertex buffer object at given offset spaced with given stride | |
bool | set_element_array (const context &ctx, const vertex_buffer &vbe) |
set the elment array to the given vertex buffer object which must me of type VBT_INDICES | |
Additional Inherited Members | |
![]() | |
attribute_array_binding_base () | |
nothing to be done heremembers | |
![]() | |
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 | |
![]() | |
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 | |
![]() | |
bool | is_enabled |
the attribute_array_binding allows to define vertex attributes (i.e.
the inputs to the vertex shader as well as an element array that stores element indices in indexed rendering. The vertex attributes can be set from instances of std::vector, pointers to arrays and vertex_buffer objects. Each individual vertex attribute can be enabled and disabled. Each vertex attribute is attached to a program location that can be queried from a shader_program with the get_attribute_location() function. The element array can only be set to a vertex_buffer object of type VBT_INDICES with the function set_element_array().
Definition at line 19 of file attribute_array_binding.h.
cgv::render::attribute_array_binding::attribute_array_binding | ( | ) |
default constructor does not create attribute array binding
create empty shader program and set the option whether errors during shader code attachment should be printed to std::cerr
Definition at line 73 of file attribute_array_binding.cxx.
cgv::render::attribute_array_binding::~attribute_array_binding | ( | ) |
destruct attribute array binding object
call destruct method
Definition at line 77 of file attribute_array_binding.cxx.
References cgv::render::render_component::ctx_ptr, destruct(), and cgv::render::context::make_current().
|
inline |
convenience function that determines attribute location in program by name and then uses set_attribute_array to set vertex attribute location to given array and enable array
Definition at line 80 of file attribute_array_binding.h.
|
inline |
convenience function that determines attribute location in program by name and then uses set_attribute_array to set a vertex attribute to a single value or an array of values through the cgv::math::vec or std::vector classes.
Definition at line 88 of file attribute_array_binding.h.
bool cgv::render::attribute_array_binding::bind_attribute_array | ( | const context & | ctx, |
const shader_program & | prog, | ||
const std::string & | attribute_name, | ||
type_descriptor | element_type, | ||
const vertex_buffer & | vbo, | ||
size_t | offset_in_bytes, | ||
size_t | nr_elements, | ||
unsigned | stride_in_bytes = 0 |
||
) |
convenience function that determines attribute location in program by name and then uses set_attribute_array to point array of vertex attribute at location loc
to elements of given type in vertex buffer object at given offset spaced with given stride
conveniance function that determines attribute location in program by name and then uses set_attribute_array to point array of vertex attribute at location loc
to elements of given type in vertex buffer object at given offset spaced with given stride
Definition at line 32 of file attribute_array_binding.cxx.
References cgv::render::shader_program::get_attribute_location(), and set_attribute_array().
bool cgv::render::attribute_array_binding::create | ( | const context & | ctx | ) |
create the attribute array binding object
create the attribute array binding
Definition at line 88 of file attribute_array_binding.cxx.
Referenced by cgv::render::build_render_info(), cgv::plot::plot_base::init(), cgv::render::gl::image_drawable::init(), and cgv::render::gl::gl_context::prepare_attributes().
void cgv::render::attribute_array_binding::destruct | ( | const context & | ctx | ) |
destruct attribute array binding object
destruct attribute array
Definition at line 94 of file attribute_array_binding.cxx.
Referenced by cgv::plot::plot_base::clear(), cgv::render::gl::image_drawable::clear(), and ~attribute_array_binding().
bool cgv::render::attribute_array_binding::disable | ( | context & | ctx | ) |
disable whole attribute array binding object
disable the attribute array binding
Definition at line 111 of file attribute_array_binding.cxx.
Referenced by cgv::render::gl::image_drawable::draw(), and cgv::render::gl::gl_context::release_attributes().
bool cgv::render::attribute_array_binding::disable_array | ( | const context & | ctx, |
int | loc | ||
) |
disable array for attribute at location loc
Definition at line 129 of file attribute_array_binding.cxx.
Referenced by cgv::render::render_info::bind(), cgv::render::gl::gl_context::prepare_attributes(), and cgv::render::gl::gl_context::release_attributes().
|
static |
disable attribute array of given location
Definition at line 58 of file attribute_array_binding.cxx.
Referenced by cgv::render::gl::cover_screen(), cgv::render::gl::gl_performance_monitor::draw(), vr_test::draw(), cgv::render::gl::image_drawable::draw(), vr_view_interactor::draw_action_zone(), cgv::render::gl::gl_context::prepare_attributes(), and cgv::render::gl::gl_context::release_attributes().
bool cgv::render::attribute_array_binding::enable | ( | context & | ctx | ) |
enable whole the attribute array binding object
enable the attribute array binding
Definition at line 101 of file attribute_array_binding.cxx.
References cgv::render::context::error(), and cgv::render::render_component::is_created().
Referenced by cgv::render::gl::image_drawable::draw(), and cgv::render::gl::gl_context::prepare_attributes().
bool cgv::render::attribute_array_binding::enable_array | ( | const context & | ctx, |
int | loc | ||
) |
enable array for vertex attribute at location loc
Definition at line 117 of file attribute_array_binding.cxx.
Referenced by cgv::plot::plot_base::init(), cgv::render::gl::image_drawable::init(), and cgv::render::gl::gl_context::prepare_attributes().
|
static |
enable attribute array of given location
Definition at line 53 of file attribute_array_binding.cxx.
Referenced by cgv::render::gl::cover_screen(), cgv::render::gl::gl_performance_monitor::draw(), vr_test::draw(), cgv::render::gl::image_drawable::draw(), vr_view_interactor::draw_action_zone(), and cgv::render::gl::gl_context::prepare_attributes().
bool cgv::render::attribute_array_binding::is_array_enabled | ( | const context & | ctx, |
int | loc | ||
) | const |
check if array of vertex attribute at location loc
is enabled
Definition at line 122 of file attribute_array_binding.cxx.
Referenced by cgv::render::attribute_array_manager::has_attribute().
|
static |
check whether an attribute array is enabled
Definition at line 47 of file attribute_array_binding.cxx.
|
inline |
set vertex attribute location to given array and enable array
Definition at line 68 of file attribute_array_binding.h.
Referenced by cgv::render::render_info::bind(), bind_attribute_array(), cgv::plot::plot_base::init(), cgv::render::gl::image_drawable::init(), and cgv::render::gl::gl_context::prepare_attributes().
|
inline |
set a vertex attribute to a single value or an array of values through the cgv::math::vec or std::vector classes.
Definition at line 73 of file attribute_array_binding.h.
bool cgv::render::attribute_array_binding::set_attribute_array | ( | const context & | ctx, |
int | loc, | ||
type_descriptor | element_type, | ||
const vertex_buffer & | vbo, | ||
size_t | offset_in_bytes, | ||
size_t | nr_elements, | ||
unsigned | stride_in_bytes = 0 |
||
) |
point array of vertex attribute at location loc
to elements of given type in vertex buffer object at given offset spaced with given stride; in case of success also enable vertex attribute array
Definition at line 21 of file attribute_array_binding.cxx.
bool cgv::render::attribute_array_binding::set_element_array | ( | const context & | ctx, |
const vertex_buffer & | vbe | ||
) |
set the elment array to the given vertex buffer object which must me of type VBT_INDICES
Definition at line 41 of file attribute_array_binding.cxx.
|
inlinestatic |
point array of vertex attribute at location loc
to array array
stored in CPU memory; in case of success also enable vertex attribute array
Definition at line 35 of file attribute_array_binding.h.
|
inlinestatic |
point array of vertex attribute at location loc
to array with nr_elements
elements pointed to by array_ptr
in CPU memory; in case of success also enable vertex attribute array
Definition at line 40 of file attribute_array_binding.h.
|
static |
point array of vertex attribute at location loc
to vertex buffer array array
stored in CPU memory; in case of success also enable vertex attribute array
Definition at line 64 of file attribute_array_binding.cxx.
Referenced by cgv::render::gl::cover_screen(), vr_test::draw(), cgv::render::gl::image_drawable::draw(), and vr_view_interactor::draw_action_zone().
|
static |
point array of vertex attribute at location loc
to elements of given type in vertex buffer object at given offset spaced with given stride; in case of success also enable vertex attribute array
Definition at line 9 of file attribute_array_binding.cxx.
|
static |
set the global elment array to the given vertex buffer object which must me of type VBT_INDICES
Definition at line 15 of file attribute_array_binding.cxx.