cogl-clip-stack: Fix flushing multiple stencil rectangles
When flushing a clip stack that contains more than one rectangle which needs to use the stencil buffer the code takes a different path so that it can combine the new rectangle with the existing contents of the stencil buffer. However it was not correctly flushing the modelview and projection matrices so that rectangle would be in the wrong place.
This commit is contained in:
parent
2ddab50ae4
commit
2b812d3d04
@ -203,6 +203,14 @@ add_stencil_clip_rectangle (float x_1,
|
||||
/* temporarily swap in our special stenciling pipeline */
|
||||
cogl_push_source (ctx->stencil_pipeline);
|
||||
|
||||
/* This can be called from the journal code which doesn't flush
|
||||
the matrix stacks between calls so we need to ensure they're
|
||||
flushed now */
|
||||
_cogl_matrix_stack_flush_to_gl (modelview_stack,
|
||||
COGL_MATRIX_MODELVIEW);
|
||||
_cogl_matrix_stack_flush_to_gl (projection_stack,
|
||||
COGL_MATRIX_PROJECTION);
|
||||
|
||||
if (first)
|
||||
{
|
||||
GE( glEnable (GL_STENCIL_TEST) );
|
||||
@ -215,14 +223,6 @@ add_stencil_clip_rectangle (float x_1,
|
||||
GE( glStencilFunc (GL_NEVER, 0x1, 0x1) );
|
||||
GE( glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE) );
|
||||
|
||||
/* This can be called from the journal code which doesn't flush
|
||||
the matrix stacks between calls so we need to ensure they're
|
||||
flushed now */
|
||||
_cogl_matrix_stack_flush_to_gl (modelview_stack,
|
||||
COGL_MATRIX_MODELVIEW);
|
||||
_cogl_matrix_stack_flush_to_gl (projection_stack,
|
||||
COGL_MATRIX_PROJECTION);
|
||||
|
||||
_cogl_rectangle_immediate (x_1, y_1, x_2, y_2);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user