GE( glStencilOp (GL_DECR, GL_DECR, GL_DECR) );
/* Decrement all of the bits twice so that only pixels where the
value is 3 will remain */
+
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
- _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
+ /* Cogl generally assumes the modelview matrix is current, so since
+ * cogl_rectangle will be flushing GL state and emitting geometry
+ * to OpenGL it will be confused if we leave the projection matrix
+ * active... */
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
+
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
+
_cogl_current_matrix_pop ();
- _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_pop ();
+
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
}
GE( glStencilMask (~(GLuint) 0) );
only pixels where both the original stencil buffer and the
rectangle are set will be valid */
GE( glStencilOp (GL_DECR, GL_DECR, GL_DECR) );
+
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
- _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
+
+ /* Cogl generally assumes the modelview matrix is current, so since
+ * cogl_rectangle will be flushing GL state and emitting geometry
+ * to OpenGL it will be confused if we leave the projection matrix
+ * active... */
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
+
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
+
_cogl_current_matrix_pop ();
- _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
+
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_pop ();
+
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
}
/* Restore the stencil mode */
GE( glStencilOp (GL_DECR, GL_DECR, GL_DECR) );
/* Decrement all of the bits twice so that only pixels where the
value is 3 will remain */
+
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
- _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
+ /* Cogl generally assumes the modelview matrix is current, so since
+ * cogl_rectangle will be flushing GL state and emitting geometry
+ * to OpenGL it will be confused if we leave the projection matrix
+ * active... */
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
+
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
+
_cogl_current_matrix_pop ();
- _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_pop ();
+
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
}
GE( glStencilMask (~(GLuint) 0) );
only pixels where both the original stencil buffer and the
rectangle are set will be valid */
GE( glStencilOp (GL_DECR, GL_DECR, GL_DECR) );
+
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
- _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
+
+ /* Cogl generally assumes the modelview matrix is current, so since
+ * cogl_rectangle will be flushing GL state and emitting geometry
+ * to OpenGL it will be confused if we leave the projection matrix
+ * active... */
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
_cogl_current_matrix_push ();
_cogl_current_matrix_identity ();
+
cogl_rectangle (-1.0, -1.0, 1.0, 1.0);
+
_cogl_current_matrix_pop ();
- _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
+
+ _cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
_cogl_current_matrix_pop ();
+
+ _cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
}
/* Restore the stencil mode */