|
From: <jt...@us...> - 2021-09-29 13:09:33
|
Revision: 1866
http://sourceforge.net/p/freeglut/code/1866
Author: jtsiomb
Date: 2021-09-29 13:09:31 +0000 (Wed, 29 Sep 2021)
Log Message:
-----------
shapes demo: added flat shading option (fixed-function only)
Modified Paths:
--------------
trunk/freeglut/freeglut/progs/demos/shapes/shapes.c
Modified: trunk/freeglut/freeglut/progs/demos/shapes/shapes.c
===================================================================
--- trunk/freeglut/freeglut/progs/demos/shapes/shapes.c 2020-02-26 16:29:18 UTC (rev 1865)
+++ trunk/freeglut/freeglut/progs/demos/shapes/shapes.c 2021-09-29 13:09:31 UTC (rev 1866)
@@ -425,6 +425,7 @@
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 @@
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 @@
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 @@
function_index = 0;
break;
+ case 'F':
+ case 'f':
+ flat ^= 1;
+ break;
+
case 'N':
case 'n': visNormals=!visNormals; break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|