renderer.set_material(&material);
renderer.set_shader_program(&shprog, &shdata);
renderer.set_texture(&texture);
- renderer.matrix_stack() *= GL::Matrix::translation(0, 0, -7);
+ renderer.transform(GL::Matrix::translation(0, 0, -7));
{
GL::Renderer::Push _push(renderer);
- renderer.matrix_stack() *= GL::Matrix::translation(-2, 0, 0);
- renderer.matrix_stack() *= GL::Matrix::rotation(angle/2.3, 0, 1, 0);
- renderer.matrix_stack() *= GL::Matrix::rotation(angle, 1, 0.25, 0);
+ renderer.transform(GL::Matrix::translation(-2, 0, 0));
+ renderer.transform(GL::Matrix::rotation(angle/2.3, 0, 1, 0));
+ renderer.transform(GL::Matrix::rotation(angle, 1, 0.25, 0));
box.draw(renderer);
}
{
GL::Renderer::Push _push(renderer);
- renderer.matrix_stack() *= GL::Matrix::translation(2, 0, 0);
- renderer.matrix_stack() *= GL::Matrix::rotation(-angle/2.3, 0, 1, 0);
- renderer.matrix_stack() *= GL::Matrix::rotation(angle, 1, 0.25, 0);
+ renderer.transform(GL::Matrix::translation(2, 0, 0));
+ renderer.transform(GL::Matrix::rotation(-angle/2.3, 0, 1, 0));
+ renderer.transform(GL::Matrix::rotation(angle, 1, 0.25, 0));
cylinder.draw(renderer);
}
}
renderer.add_shader_data(progdata);
for(unsigned i=0; i<12; ++i)
{
- GL::MatrixStack::Push push(renderer.matrix_stack());
+ GL::Renderer::Push push(renderer);
renderer.set_shader_program(programs[i]);
- renderer.matrix_stack() *= GL::Matrix::translation(-3.3+(i%4)*2.2, 0, -3.5+(i/4)*3.0);
- renderer.matrix_stack() *= GL::Matrix::rotation(angle, 0, 0, 1);
+ renderer.transform(GL::Matrix::translation(-3.3+(i%4)*2.2, 0, -3.5+(i/4)*3.0));
+ renderer.transform(GL::Matrix::rotation(angle, 0, 0, 1));
mesh.draw(renderer);
}
}
times without an intervening end(). */
void begin(const Camera *);
+ /** Deprecated as unsafe. Use set_matrix() or transform() instead. */
MatrixStack &matrix_stack() { return mtx_stack; }
+ /** Replaces the Renderer's modelview matrix. */
+ void set_matrix(const Matrix &);
+
+ /** Applies a transform to the Renderer's modelview matrix. */
+ void transform(const Matrix &);
+
+ /** Returns the current modelview matrix. */
+ const Matrix &get_matrix() const { return mtx_stack.top(); }
+
const Camera *get_camera() const { return camera; }
void set_texture(const Texture *);