avoid touching fb matrix stack directly

This ensures we don't touch a framebuffer's matrix stack directly if we
are also relying on _cogl_framebuffer_flush_state(). We want to get to
the point where we can set dirty flags against framebuffer state at the
point it changes but that means we can't allow direct access to the
matrix stack. _cogl_texture_draw_and_read() has now been changed so it
uses cogl_framebuffer_ methods to update the matrix stacks including
adding new internal _cogl_framebuffer_push/pop_projection() functions
that allow us to set transient projections.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg
2011-11-20 18:50:29 +00:00
parent 5ca78668af
commit 652c8c31cf
3 changed files with 36 additions and 15 deletions

View File

@ -1915,6 +1915,27 @@ cogl_framebuffer_orthographic (CoglFramebuffer *framebuffer,
_cogl_matrix_stack_set (projection_stack, &ortho);
}
void
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer)
{
CoglMatrixStack *projection_stack =
_cogl_framebuffer_get_projection_stack (framebuffer);
_cogl_matrix_stack_push (projection_stack);
framebuffer->context->current_draw_buffer_changes |=
COGL_FRAMEBUFFER_STATE_PROJECTION;
}
void
_cogl_framebuffer_pop_projection (CoglFramebuffer *framebuffer)
{
CoglMatrixStack *projection_stack =
_cogl_framebuffer_get_projection_stack (framebuffer);
_cogl_matrix_stack_pop (projection_stack);
framebuffer->context->current_draw_buffer_changes |=
COGL_FRAMEBUFFER_STATE_PROJECTION;
}
void
cogl_framebuffer_get_modelview_matrix (CoglFramebuffer *framebuffer,
CoglMatrix *matrix)