cgv
|
#include <attribute_array_binding.h>
Public Member Functions | |
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 | |
Public Attributes | |
const context * | ctx_ptr |
keep pointer to my context | |
std::string | last_error |
a string that contains the last error | |
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 More... | |
~attribute_array_binding () | |
destruct attribute array binding object More... | |
bool | create (const context &ctx) |
create the attribute array binding object More... | |
void | destruct (const context &ctx) |
destruct attribute array binding object More... | |
bool | enable (context &ctx) |
enable whole the attribute array binding object More... | |
bool | disable (context &ctx) |
disable whole attribute array binding object More... | |
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 More... | |
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 | |
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().
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
cgv::render::attribute_array_binding::~attribute_array_binding | ( | ) |
destruct attribute array binding object
call destruct method
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
bool cgv::render::attribute_array_binding::create | ( | const context & | ctx | ) |
create the attribute array binding object
create the attribute array binding
void cgv::render::attribute_array_binding::destruct | ( | const context & | ctx | ) |
destruct attribute array binding object
destruct attribute array
bool cgv::render::attribute_array_binding::disable | ( | context & | ctx | ) |
disable whole attribute array binding object
disable the attribute array binding
bool cgv::render::attribute_array_binding::enable | ( | context & | ctx | ) |
enable whole the attribute array binding object
enable the attribute array binding
|
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.