summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-13 14:22:46 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-13 14:22:46 -0600
commitdc313b578386dc07f4916fba98da061af3ab18e5 (patch)
tree28dc7a6218e61a152136555e3f32d017c1762b2d /src/mesa/state_tracker
parent2bf4a500de24347476ce96cdd48d68ddeecbb019 (diff)
Fix more polygon winding, culling confusion.
If the determinant of the triangle is positive, its winding is CCW (right-handed coord system).
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_setup.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_atom_setup.c b/src/mesa/state_tracker/st_atom_setup.c
index 8b95ea958e..08f7a8a732 100644
--- a/src/mesa/state_tracker/st_atom_setup.c
+++ b/src/mesa/state_tracker/st_atom_setup.c
@@ -78,13 +78,19 @@ static void update_setup_state( struct st_context *st )
/* _NEW_POLYGON, _NEW_BUFFERS
*/
{
- setup.front_winding = PIPE_WINDING_CW;
-
+ if (ctx->Polygon.FrontFace == GL_CCW)
+ setup.front_winding = PIPE_WINDING_CCW;
+ else
+ setup.front_winding = PIPE_WINDING_CW;
+
+ /* XXX
+ * I think the intention here is that user-created framebuffer objects
+ * use Y=0=TOP layout instead of OpenGL's normal Y=0=bottom layout.
+ * Flipping Y changes CW to CCW and vice-versa.
+ * But this is an implementation/driver-specific artifact - remove...
+ */
if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
- setup.front_winding ^= PIPE_WINDING_BOTH;
-
- if (ctx->Polygon.FrontFace != GL_CCW)
- setup.front_winding ^= PIPE_WINDING_BOTH;
+ setup.front_winding ^= PIPE_WINDING_BOTH;
}
/* _NEW_LIGHT