Make backface culling be part of the legacy state

This adds an internal function to set the backface culling state on a
pipeline. This includes properties to set the culling mode (front,
back or both) and also to set which face is considered the front
(COGL_WINDING_CLOCKWISE or COGL_WINDING_COUNTER_CLOCKWISE). The actual
front face flushed to GL depends on whether we are rendering to an
offscreen buffer or not. This means that when changing between on- and
off- screen framebuffers it now checks whether the last flushed
pipeline has backface culling enabled and forces a reflush of the cull
face state if so.

The backface culling is now set on a pipeline as part of the legacy
state. This is important because some code in Cogl assumes it can
flush a temporary pipeline to revert to a known state, but previously
this wouldn't disable backface culling so things such as flushing the
clip stack could get confused.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts
2011-09-15 11:25:39 +01:00
committed by Robert Bragg
parent 879ce7301a
commit dbff3a357e
12 changed files with 258 additions and 103 deletions

View File

@ -74,8 +74,7 @@ struct _CoglContext
/* Enable cache */
unsigned long enable_flags;
gboolean enable_backface_culling;
CoglFrontWinding flushed_front_winding;
gboolean legacy_backface_culling_enabled;
/* A few handy matrix constants */
CoglMatrix identity_matrix;