It's unnecessary because VertexArray has its own state tracking and never
needs to be unbound.
void Mesh::draw(Renderer &renderer) const
{
- renderer.set_vertex_array(&vertices);
+ vertices.apply();
renderer.set_element_buffer(ibuf);
renderer.set_winding_test(winding);
camera(c),
state_stack(1),
lighting_changed(false),
- vertex_array(0),
element_buffer(0)
{
state_stack.reserve(16);
shdata_changed = true;
}
-void Renderer::set_vertex_array(const VertexArray *a)
-{
- vertex_array = a;
-}
-
void Renderer::set_element_buffer(const Buffer *b)
{
element_buffer = b;
void Renderer::draw(const Batch &batch)
{
- if(!vertex_array)
- throw invalid_operation("Renderer::draw");
-
apply_state();
- vertex_array->apply();
-
if(element_buffer)
element_buffer->bind_to(ELEMENT_ARRAY_BUFFER);
else
class Renderable;
class Texture;
class Texturing;
-class VertexArray;
class WindingTest;
/**
bool lighting_changed;
std::vector<const ProgramData *> shdata_stack;
bool shdata_changed;
- const VertexArray *vertex_array;
const Buffer *element_buffer;
std::set<const Renderable *> excluded;
Renderer state is popped. */
void add_shader_data(const ProgramData &data);
- void set_vertex_array(const VertexArray *);
void set_element_buffer(const Buffer *);
void set_winding_test(const WindingTest *);
void set_reverse_winding(bool);