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

@ -549,9 +549,6 @@ enable_gl_state (CoglDrawFlags flags,
_cogl_pipeline_flush_gl_state (source, skip_gl_color, n_tex_coord_attribs);
if (ctx->enable_backface_culling)
enable_flags |= COGL_ENABLE_BACKFACE_CULLING;
_cogl_bitmask_clear_all (&ctx->temp_bitmask);
/* Bind the attribute pointers. We need to do this after the
@ -726,7 +723,6 @@ enable_gl_state (CoglDrawFlags flags,
set_enabled_arrays (&ctx->arrays_enabled, &ctx->temp_bitmask);
_cogl_enable (enable_flags);
_cogl_flush_face_winding ();
return source;
}