83 friend class cgv::g2d::generic_2d_renderer;
88 bool state_out_of_date =
true;
89 std::vector<unsigned> idx;
92 bool set_attribute_array(
const context& ctx,
const shader_program& prog,
const std::string& name,
const T& array) {
95 return aam.set_attribute_array(ctx, loc, array);
99 void clear_attribute_arrays(
context& ctx) {
100 if(aam.is_created()) {
106 bool set_indices(
const context& ctx) {
107 return aam.set_indices(ctx, idx);
110 void remove_indices(
const context& ctx) {
111 return aam.remove_indices(ctx);
117 void destruct(
const context& ctx) {
122 return aam.init(ctx);
125 void add_idx(
const unsigned int i) { idx.push_back(i); }
127 std::vector<unsigned>& ref_idx() {
return idx; }
128 const std::vector<unsigned>& ref_idx()
const {
return idx; }
130 void set_out_of_date() {
131 state_out_of_date =
true;
134 virtual size_t render_count()
const = 0;
136 bool has_indices()
const {
141 if(!aam.is_created())
144 if(render_count() > 0) {
146 if(state_out_of_date)
147 res = transfer(ctx, prog);
150 return aam.enable(ctx);
151 }
else if(state_out_of_date) {
159 return aam.disable(ctx);
base class for all drawables, which is independent of the used rendering API.