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
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
glutSetOption(GLUT_GEOMETRY_VISUALIZE_NORMALS,visNormals); /* Normals visualized or not? */
+ glShadeModel(flat ? GL_FLAT : GL_SMOOTH); /* flat or gouraud shading */
+
if (useShader && !shaderReady)
initShader();
function_index = 0;
break;
+ case 'F':
+ case 'f':
+ flat ^= 1;
+ break;
+
case 'N':
case 'n': visNormals=!visNormals; break;