diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-07-12 11:50:52 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-07-12 11:50:52 -0600 |
commit | 62f5f18b3e5b80b6d9592442dc3c994d590c782d (patch) | |
tree | 5c4569097bec7bfb9f2e9a48ee3b54ccba933553 /src/mesa/pipe/draw | |
parent | 5b06424a1507dadad8832d557e79f68a3b68b9c2 (diff) |
handle edge flags for GL_POLYGONs
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r-- | src/mesa/pipe/draw/draw_vb.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/mesa/pipe/draw/draw_vb.c b/src/mesa/pipe/draw/draw_vb.c index 905e465447..67e196618a 100644 --- a/src/mesa/pipe/draw/draw_vb.c +++ b/src/mesa/pipe/draw/draw_vb.c @@ -255,16 +255,28 @@ static void draw_indexed_prim( struct draw_context *draw, case GL_POLYGON: if (count >= 3) { + int e1save, e2save; prim.v[0] = 0; prim.v[1] = get_vertex( draw, elts[1] ); prim.v[2] = get_vertex( draw, elts[0] ); + e2save = prim.v[2]->edgeflag; for (i = 0; i+2 < count; i++) { prim.v[0] = prim.v[1]; prim.v[1] = get_vertex( draw, elts[i+2] ); + /* save v1 edge flag, and clear if not last triangle */ + e1save = prim.v[1]->edgeflag; + if (i + 3 < count) + prim.v[1]->edgeflag = 0; + + /* draw */ first->tri( first, &prim ); + + prim.v[1]->edgeflag = e1save; /* restore */ + prim.v[2]->edgeflag = 0; /* disable edge after 1st tri */ } + prim.v[2]->edgeflag = e2save; } break; @@ -399,16 +411,28 @@ static void draw_prim( struct draw_context *draw, case GL_POLYGON: if (count >= 3) { + int e1save, e2save; prim.v[0] = 0; prim.v[1] = get_vertex( draw, start + 1 ); prim.v[2] = get_vertex( draw, start + 0 ); - + e2save = prim.v[2]->edgeflag; + for (i = 0; i+2 < count; i++) { prim.v[0] = prim.v[1]; prim.v[1] = get_vertex( draw, start + i + 2 ); - + + /* save v1 edge flag, and clear if not last triangle */ + e1save = prim.v[1]->edgeflag; + if (i + 3 < count) + prim.v[1]->edgeflag = 0; + + /* draw */ first->tri( first, &prim ); + + prim.v[1]->edgeflag = e1save; /* restore */ + prim.v[2]->edgeflag = 0; /* disable edge after 1st tri */ } + prim.v[2]->edgeflag = e2save; } break; |