state->shdata.assign(1, d);
else
state->shdata.clear();
+ shdata_changed = true;
}
void Renderer::add_shader_data(const ProgramData *d)
throw invalid_operation("Renderer::add_shader_data");
state->shdata.push_back(d);
+ shdata_changed = true;
}
void Renderer::set_vertex_array(const VertexArray *a)
state = &state_stack.back();
mtx_stack.pop();
mtx_changed = true;
+ shdata_changed = true;
}
void Renderer::escape()
if(state->shprog)
{
state->shprog->bind();
- for(vector<const ProgramData *>::const_iterator i=state->shdata.begin(); i!=state->shdata.end(); ++i)
- (*i)->apply();
+ if(shdata_changed)
+ {
+ for(vector<const ProgramData *>::const_iterator i=state->shdata.begin(); i!=state->shdata.end(); ++i)
+ (*i)->apply();
+ shdata_changed = false;
+ }
}
else
Program::unbind();
const VertexArray *vertex_array;
bool vertex_array_changed;
const Buffer *element_buffer;
+ bool shdata_changed;
public:
Renderer(const Camera *);