diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-07-13 14:25:28 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-07-13 14:25:28 -0600 |
commit | a2e471e05e452454f78db7a5fbc6845f6ca39f35 (patch) | |
tree | b1859aee540865940515128273a4fdc2d41550f5 /progs | |
parent | dc313b578386dc07f4916fba98da061af3ab18e5 (diff) | |
download | external_mesa3d-a2e471e05e452454f78db7a5fbc6845f6ca39f35.zip external_mesa3d-a2e471e05e452454f78db7a5fbc6845f6ca39f35.tar.gz external_mesa3d-a2e471e05e452454f78db7a5fbc6845f6ca39f35.tar.bz2 |
press 'f' to toggle front-face winding
Diffstat (limited to 'progs')
-rw-r--r-- | progs/trivial/tri-cull.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/progs/trivial/tri-cull.c b/progs/trivial/tri-cull.c index af26cb0..2eead84 100644 --- a/progs/trivial/tri-cull.c +++ b/progs/trivial/tri-cull.c @@ -29,6 +29,7 @@ static GLenum doubleBuffer; static GLint cullmode = 0; +static GLenum front = GL_CCW; /* GL default */ static void cull(void) { @@ -76,11 +77,16 @@ static void Reshape(int width, int height) static void Key(unsigned char key, int x, int y) { switch (key) { - case 27: - exit(1); + case 27: + exit(1); case 'c': cull(); break; + case 'f': + front = ((front == GL_CCW) ? GL_CW : GL_CCW); + glFrontFace(front); + printf("front face = %s\n", front == GL_CCW ? "GL_CCW" : "GL_CW"); + break; default: return; } @@ -92,7 +98,7 @@ static void Draw(void) glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); - /* back-facing */ + /* CCW / front-facing */ glColor3f(0,0,.7); glVertex3f(-0.1, -0.9, -30.0); glColor3f(.8,0,0); @@ -100,7 +106,7 @@ static void Draw(void) glColor3f(0,.9,0); glVertex3f(-0.9, 0.0, -30.0); - /* front-facing */ + /* CW / back-facing */ glColor3f(0,0,.7); glVertex3f( 0.1, -0.9, -30.0); glColor3f(.8,0,0); |