X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2Fshapes%2Fshapes.c;h=09fb5efa2dafe45eb203e05bd56166478d710648;hb=073805e06f3693e135f62ac0f999e2e31caa02f5;hp=69c0a1a94da8ee20a70dedfefc7adb3b9b7f1281;hpb=36c90d8d0257ed1e078f64708d6fb2408361ca5a;p=freeglut diff --git a/progs/demos/shapes/shapes.c b/progs/demos/shapes/shapes.c index 69c0a1a..09fb5ef 100644 --- a/progs/demos/shapes/shapes.c +++ b/progs/demos/shapes/shapes.c @@ -425,6 +425,7 @@ static GLboolean persProject = GL_TRUE; static GLboolean animateXRot = GL_FALSE; static GLboolean useShader = GL_FALSE; static GLboolean visNormals = GL_FALSE; +static GLboolean flat; /* * Enum to tell drawSizeInfo what to draw for each object @@ -653,10 +654,15 @@ static void drawInfo() shapesPrintf (row++, 1, "Perspective projection (p)"); else shapesPrintf (row++, 1, "Orthographic projection (p)"); - if (useShader) + if (useShader) { shapesPrintf (row++, 1, "Using shader (s)"); - else + } else { shapesPrintf (row++, 1, "Using fixed function pipeline (s)"); + if (flat) + shapesPrintf (row++, 1, "Flat shading (f)"); + else + shapesPrintf (row++, 1, "Smooth shading (f)"); + } if (animateXRot) shapesPrintf (row++, 1, "2D rotation (r)"); else @@ -683,6 +689,8 @@ static void display(void) glutSetOption(GLUT_GEOMETRY_VISUALIZE_NORMALS,visNormals); /* Normals visualized or not? */ + glShadeModel(flat ? GL_FLAT : GL_SMOOTH); /* flat or gouraud shading */ + if (useShader && !shaderReady) initShader(); @@ -820,6 +828,11 @@ key(unsigned char key, int x, int y) function_index = 0; break; + case 'F': + case 'f': + flat ^= 1; + break; + case 'N': case 'n': visNormals=!visNormals; break;