3#include "element_traits.h"
10 class CGV_API vertex_buffer;
21 int get_attribute_location(
const context& ctx,
const shader_program& prog,
const std::string& attr_name)
const;
26 static bool is_global_array_enabled(
const context& ctx,
int loc);
28 static bool enable_global_array(
const context& ctx,
int loc);
30 static bool disable_global_array(
const context& ctx,
int loc);
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);
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>
base class for attribute_array_bindings
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...
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...
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
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.
compact type description of data that can be sent to the context; convertible to int