3#include "element_traits.h"
21 int get_attribute_location(
const context& ctx,
const shader_program& prog,
const std::string& attr_name)
const;
41 return ctx.set_attribute_array_void(0, loc, element_descriptor_traits<T>::get_type_descriptor(*array_ptr), 0, array_ptr, nr_elements, stride);
44 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);
53 bool create(
const context& ctx);
55 void destruct(
const context& ctx);
61 bool enable_array(
const context& ctx,
int loc);
63 bool is_array_enabled(
const context& ctx,
int loc)
const;
65 bool disable_array(
const context& ctx,
int loc);
73 bool set_attribute_array(
const context& ctx,
int loc,
const T* value_ptr,
unsigned nr_elements,
unsigned stride = 0) {
74 return ctx.set_attribute_array_void(
this, loc, get_element_type(*value_ptr), 0, value_ptr, nr_elements, stride);
77 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);
81 int loc = get_attribute_location(ctx, prog, attribute_name);
89 int loc = get_attribute_location(ctx, prog, attribute_name);
92 return ctx.set_attribute_array_void(
this, loc, get_element_type(*value_ptr), 0, value_ptr, nr_elements, stride);
95 bool bind_attribute_array(
const context& ctx,
98 size_t offset_in_bytes,
size_t nr_elements,
unsigned stride_in_bytes = 0);
106#include <cgv/config/lib_end.h>
attribute_array_binding_base()
nothing to be done heremembers
the attribute_array_binding allows to define vertex attributes (i.e.
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::vec...
static bool enable_global_array(const context &ctx, int loc)
enable 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...
static bool is_global_array_enabled(const context &ctx, int loc)
check whether an attribute array is enabled
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_attribut...
static bool disable_global_array(const context &ctx, int loc)
disable attribute array of given location
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_attribut...
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 arra...
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 succe...
bool set_attribute_array(const context &ctx, int loc, const T &array)
set vertex attribute location to given array and enable array
attribute_array_binding()
default constructor does not create attribute array binding
base class for all drawables, which is independent of the used rendering API.
a shader program combines several shader code fragments to a complete definition of the shading pipel...
a vertex buffer is an unstructured memory block on the GPU.
namespace for api independent GPU programming
this header is dependency free
compact type description of data that can be sent to the context; convertible to int