Flush the journal before changing the projection

Since the projection matrix isn't tracked in the journal and since our
software transform of vertices as we log into the journal doesn't
include the projective transform we need to make sure we flush all
primitives in the journal before ever changing the projection.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-08-01 20:50:47 +01:00
parent ee01fd263a
commit 89fd2edeb0

View File

@ -826,6 +826,10 @@ cogl_frustum (float left,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* XXX: The projection matrix isn't currently tracked in the journal
* so we need to flush all journaled primitives first... */
cogl_flush ();
_cogl_matrix_stack_load_identity (projection_stack);
_cogl_matrix_stack_frustum (projection_stack,
@ -851,6 +855,10 @@ cogl_ortho (float left,
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* XXX: The projection matrix isn't currently tracked in the journal
* so we need to flush all journaled primitives first... */
cogl_flush ();
cogl_matrix_init_identity (&ortho);
cogl_matrix_ortho (&ortho, left, right, bottom, top, z_near, z_far);
_cogl_matrix_stack_set (projection_stack, &ortho);
@ -888,10 +896,13 @@ cogl_set_projection_matrix (CoglMatrix *matrix)
{
CoglMatrixStack *projection_stack =
_cogl_framebuffer_get_projection_stack (cogl_get_draw_framebuffer ());
/* XXX: The projection matrix isn't currently tracked in the journal
* so we need to flush all journaled primitives first... */
cogl_flush ();
_cogl_matrix_stack_set (projection_stack, matrix);
/* FIXME: Update the inverse projection matrix!! Presumably use
* of clip planes must currently be broken if this API is used. */
_COGL_MATRIX_DEBUG_PRINT (matrix);
}