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;
25 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);
36 return ctx.set_attribute_array_void(0, loc, array_descriptor_traits<T>::get_type_descriptor(array), 0, array_descriptor_traits<T>::get_address(array), array_descriptor_traits<T>::get_nr_elements(array));
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);
69 return ctx.set_attribute_array_void(
this, loc, array_descriptor_traits<T>::get_type_descriptor(array), 0, array_descriptor_traits<T>::get_address(array), array_descriptor_traits<T>::get_nr_elements(array));
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);
84 return ctx.set_attribute_array_void(
this, loc, array_descriptor_traits<T>::get_type_descriptor(array), 0, array_descriptor_traits<T>::get_address(array), array_descriptor_traits<T>::get_nr_elements(array));
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>