I never used escape() for much anything, and now it's causing problems on
OpenGL ES by trying to apply state with no shader and consequently set
system matrices. In the future I'll add a corresponding begin() call to
allow persistent Renderers.
renderer.render(*j->renderable, i->get_tag());
}
renderer.render(*j->renderable, i->get_tag());
}
- if(matrices_loaded)
- {
- if(camera)
- MatrixStack::projection().pop();
- MatrixStack::modelview().pop();
- }
-
- Mesh::unbind();
- Texturing::unbind();
- Texture::unbind_from(0);
- Material::unbind();
- Lighting::unbind();
- Program::unbind();
- Buffer::unbind_from(ELEMENT_ARRAY_BUFFER);
- WindingTest::unbind();
}
void Renderer::set_texture(const Texture *t)
}
void Renderer::set_texture(const Texture *t)
matrices_loaded = false;
}
matrices_loaded = false;
}
+void Renderer::end()
+{
+ if(state_stack.size()>1)
+ throw invalid_operation("Renderer::end");
+
+ if(matrices_loaded)
+ {
+ if(camera)
+ MatrixStack::projection().pop();
+ MatrixStack::modelview().pop();
+ }
+
+ Mesh::unbind();
+ Texturing::unbind();
+ Texture::unbind_from(0);
+ Material::unbind();
+ Lighting::unbind();
+ Program::unbind();
+ Buffer::unbind_from(ELEMENT_ARRAY_BUFFER);
+ WindingTest::unbind();
+
+ *state = State();
+}
+
void Renderer::exclude(const Renderable &renderable)
{
excluded.insert(&renderable);
void Renderer::exclude(const Renderable &renderable)
{
excluded.insert(&renderable);
/** Prepares for temporarily bypassing the Renderer by synchronizing the
current state with GL. No additional call is necessary to resume using the
/** Prepares for temporarily bypassing the Renderer by synchronizing the
current state with GL. No additional call is necessary to resume using the
+ Renderer. DEPRECATED. */
+ /** Ends rendering, unbinding all objects and resetting state. There must
+ be no unpopped state in the stack. */
+ void end();
+
void exclude(const Renderable &);
void include(const Renderable &);
void exclude(const Renderable &);
void include(const Renderable &);