From: Keith Whitwell Date: Wed, 1 Jun 2005 07:02:23 +0000 (+0000) Subject: Add a mode to test flat shading + separate specular. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=502504de2336a64698be544c83697632e4628138;p=mesa.git Add a mode to test flat shading + separate specular. --- diff --git a/progs/demos/spectex.c b/progs/demos/spectex.c index cfa7f74a21a..6ab1191579c 100644 --- a/progs/demos/spectex.c +++ b/progs/demos/spectex.c @@ -33,6 +33,7 @@ static GLint Mode = 4; static GLfloat Black[4] = {0.0, 0.0, 0.0, 1.0}; static GLfloat White[4] = {1.0, 1.0, 1.0, 1.0}; +static GLboolean smooth = 1; static void Idle(void) @@ -143,9 +144,16 @@ static void Key( unsigned char key, int x, int y ) (void) x; (void) y; switch (key) { - case 27: - exit(0); - break; + case 27: + exit(0); + break; + case 's': + smooth = !smooth; + if (smooth) + glShadeModel(GL_SMOOTH); + else + glShadeModel(GL_FLAT); + break; } glutPostRedisplay(); } @@ -175,6 +183,8 @@ static void Init( void ) glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Black); + glShadeModel(GL_SMOOTH); + glMaterialfv(GL_FRONT, GL_DIFFUSE, White); glMaterialfv(GL_FRONT, GL_SPECULAR, White); glMaterialf(GL_FRONT, GL_SHININESS, 20.0);