From: Brian Date: Tue, 10 Jul 2007 17:53:27 +0000 (-0600) Subject: press 'f' to toggle GL_CCW/GL_CW front face X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=24b68f4184c1f899f21038508068631184ca736a;p=mesa.git press 'f' to toggle GL_CCW/GL_CW front face --- diff --git a/progs/trivial/tri-edgeflag.c b/progs/trivial/tri-edgeflag.c index 838f2b025ae..41899c2eb4f 100644 --- a/progs/trivial/tri-edgeflag.c +++ b/progs/trivial/tri-edgeflag.c @@ -27,25 +27,18 @@ #include #include - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; +static GLenum doubleBuffer; +static GLenum frontface = GL_CCW; static void Init(void) { fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - - glClearColor(0.0, 0.0, 1.0, 0.0); } static void Reshape(int width, int height) { - glViewport(0, 0, (GLint)width, (GLint)height); glMatrixMode(GL_PROJECTION); @@ -56,13 +49,16 @@ static void Reshape(int width, int height) static void Key(unsigned char key, int x, int y) { - - switch (key) { - case 27: - exit(1); - default: - return; - } + switch (key) { + case 'f': + frontface = (frontface == GL_CCW) ? GL_CW : GL_CCW; + glFrontFace(frontface); + break; + case 27: + exit(1); + default: + return; + } glutPostRedisplay(); } @@ -75,7 +71,7 @@ static void Draw(void) glBegin(GL_TRIANGLES); glEdgeFlag(1); - glColor3f(0,0,.7); + glColor3f(0.3,0.3,.9); glVertex3f( 0.9, -0.9, -0.0); glEdgeFlag(0); glColor3f(.8,0,0); @@ -137,5 +133,5 @@ int main(int argc, char **argv) glutKeyboardFunc(Key); glutDisplayFunc(Draw); glutMainLoop(); - return 0; + return 0; }