[cogl matrix] Adds ability to dirty state cached by the client matrix apis

To be able to load matrices to GL manually within Cogl we need a way to
dirty the state cached by the client matrix stack API.
This commit is contained in:
Robert Bragg 2009-06-17 02:08:31 +01:00
parent 26d5afd203
commit 27fff12a6a
4 changed files with 24 additions and 0 deletions

View File

@ -354,6 +354,21 @@ _cogl_current_matrix_state_flush (void)
} }
} }
void
_cogl_current_matrix_state_dirty (void)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (ctx->matrix_mode != COGL_MATRIX_MODELVIEW)
{
g_warning ("matrix state must be dirtied in MODELVIEW mode");
return;
}
if (ctx->modelview_stack)
_cogl_matrix_stack_dirty (ctx->modelview_stack);
}
void void
cogl_push_matrix (void) cogl_push_matrix (void)
{ {

View File

@ -88,5 +88,6 @@ void _cogl_get_matrix (CoglMatrixMode mode,
void _cogl_current_matrix_state_init (void); void _cogl_current_matrix_state_init (void);
void _cogl_current_matrix_state_destroy (void); void _cogl_current_matrix_state_destroy (void);
void _cogl_current_matrix_state_flush (void); void _cogl_current_matrix_state_flush (void);
void _cogl_current_matrix_state_dirty (void);
#endif /* __COGL_CURRENT_MATRIX_H */ #endif /* __COGL_CURRENT_MATRIX_H */

View File

@ -360,3 +360,10 @@ _cogl_matrix_stack_flush_to_gl (CoglMatrixStack *stack,
if (gl_mode != GL_MODELVIEW) if (gl_mode != GL_MODELVIEW)
GE (glMatrixMode (GL_MODELVIEW)); GE (glMatrixMode (GL_MODELVIEW));
} }
void
_cogl_matrix_stack_dirty (CoglMatrixStack *stack)
{
stack->flushed_state = NULL;
}

View File

@ -76,5 +76,6 @@ void _cogl_matrix_stack_set (CoglMatrixStack *stack,
const CoglMatrix *matrix); const CoglMatrix *matrix);
void _cogl_matrix_stack_flush_to_gl (CoglMatrixStack *stack, void _cogl_matrix_stack_flush_to_gl (CoglMatrixStack *stack,
GLenum gl_mode); GLenum gl_mode);
void _cogl_matrix_stack_dirty (CoglMatrixStack *stack);
#endif /* __COGL_MATRIX_STACK_H */ #endif /* __COGL_MATRIX_STACK_H */