shapes demo: cuboctahedron is from the demo itself and not from FreeGLUT
authorDiederick Niehorster <dcnieho@gmail.com>
Sun, 18 Nov 2012 15:49:27 +0000 (15:49 +0000)
committerDiederick Niehorster <dcnieho@gmail.com>
Sun, 18 Nov 2012 15:49:27 +0000 (15:49 +0000)
geometry. Hence not supported in shader drawing mode. Now skipping it

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1404 7f0cb862-5218-0410-a997-914c9d46530a

progs/demos/shapes/shapes.c

index b2da232..2ae69ab 100644 (file)
@@ -759,7 +759,12 @@ key(unsigned char key, int x, int y)
     case 'r': animateXRot=!animateXRot;   break;
 
     case 'S':
-    case 's': useShader=!useShader;       break;
+    case 's':
+        useShader=!useShader;
+        /* Cuboctahedron can't be shown when in shader mode, move to next */
+        if (useShader && NUMBEROF (table)-1 == ( unsigned )function_index)
+                function_index = 0;
+        break;
 
     case 'N':
     case 'n': visNormals=!visNormals;     break;
@@ -792,6 +797,13 @@ static void special (int key, int x, int y)
 
     if (NUMBEROF (table) <= ( unsigned )function_index)
         function_index = 0;
+
+    /* Cuboctahedron can't be shown when in shader mode, skip it */
+    if (useShader && NUMBEROF (table)-1 == ( unsigned )function_index)
+        if (key==GLUT_KEY_PAGE_UP)
+            function_index = 0;
+        else
+            function_index -= 1;
 }