summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-13 15:02:50 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-08-13 15:02:50 -0600
commitc271078048770a31028836eda684a6dbffc13cf5 (patch)
tree7373d346e2bcbfd65b002bb58fca2ab9d511835a
parentfaa14a9ded2ddb784302b4634f0ca40c51ec1c4b (diff)
with Y=0=top, front/back determination is negated
-rw-r--r--src/mesa/pipe/draw/draw_cull.c4
-rw-r--r--src/mesa/pipe/draw/draw_twoside.c4
-rw-r--r--src/mesa/pipe/draw/draw_unfilled.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c
index 8b2ac5ea5f9..48a7f5dab8e 100644
--- a/src/mesa/pipe/draw/draw_cull.c
+++ b/src/mesa/pipe/draw/draw_cull.c
@@ -78,10 +78,10 @@ static void cull_tri( struct draw_stage *stage,
header->det = ex * fy - ey * fx;
if (header->det != 0) {
- /* if (det > 0 then Z points toward camera and triangle is
+ /* if (det < 0 then Z points toward camera and triangle is
* counter-clockwise winding.
*/
- GLuint winding = (header->det > 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW;
+ GLuint winding = (header->det < 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW;
if ((winding & cull_stage(stage)->winding) == 0) {
/* triangle is not culled, pass to next stage */
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c
index fdda6b362fa..20b2b4a8aa4 100644
--- a/src/mesa/pipe/draw/draw_twoside.c
+++ b/src/mesa/pipe/draw/draw_twoside.c
@@ -53,9 +53,9 @@ static void twoside_begin( struct draw_stage *stage )
/*
* We'll multiply the primitive's determinant by this sign to determine
* if the triangle is back-facing (negative).
- * sign = 1 for CCW, -1 for CW
+ * sign = -1 for CCW, +1 for CW
*/
- twoside->sign = (stage->draw->setup.front_winding == PIPE_WINDING_CCW) ? 1 : -1;
+ twoside->sign = (stage->draw->setup.front_winding == PIPE_WINDING_CCW) ? -1 : 1;
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c
index 82e8775f59f..05242d8d107 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/mesa/pipe/draw/draw_unfilled.c
@@ -119,7 +119,7 @@ static void unfilled_tri( struct draw_stage *stage,
struct prim_header *header )
{
struct unfilled_stage *unfilled = unfilled_stage(stage);
- GLuint mode = unfilled->mode[header->det > 0.0];
+ GLuint mode = unfilled->mode[header->det < 0.0];
switch (mode) {
case PIPE_POLYGON_MODE_FILL: