Make Android work again - adapt to recent changes and fix use of GL-nonES function
[freeglut] / progs / test-shapes-gles1 / test-shapes-gles1.c
index 56b3569..e0bdd01 100644 (file)
@@ -37,6 +37,7 @@
 */
 
 #include <GL/freeglut.h>
+#include <GL/freeglut_ext.h>
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -99,6 +100,10 @@ static void drawSolidCone(void)                { glutSolidCone(orad,orad,slices,
 static void drawWireCone(void)                 { glutWireCone(orad,orad,slices,stacks);          }  /* orad doubles as size input */
 static void drawSolidCylinder(void)            { glutSolidCylinder(orad,orad,slices,stacks);     }  /* orad doubles as size input */
 static void drawWireCylinder(void)             { glutWireCylinder(orad,orad,slices,stacks);      }  /* orad doubles as size input */
+static void drawSolidTeapot(void)
+{   glFrontFace(GL_CW);    glutSolidTeapot(orad);   glFrontFace(GL_CCW);    /* orad doubles as size input */}
+static void drawWireTeapot(void)
+{   glFrontFace(GL_CW);    glutWireTeapot(orad);    glFrontFace(GL_CCW);    /* orad doubles as size input */}
 
 /*
  * This structure defines an entry in our function-table.
@@ -120,7 +125,7 @@ static const entry table [] =
     ENTRY (RhombicDodecahedron),
     ENTRY (Icosahedron),
     ENTRY (SierpinskiSponge),
-    /* ENTRY (Teapot), */
+    ENTRY (Teapot),
     ENTRY (Torus),
     ENTRY (Sphere),
     ENTRY (Cone),
@@ -281,25 +286,8 @@ const GLfloat high_shininess[] = { 100.0f };
 
 /* Program entry point */
 
-int
-main(int argc, char *argv[])
-{
-    glutInitWindowSize(640,480);
-    glutInitWindowPosition(40,40);
-    glutInit(&argc, argv);
-    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
-
-    glutCreateWindow("FreeGLUT Shapes");
-
-    glutReshapeFunc(resize);
-    glutDisplayFunc(display);
-    glutKeyboardFunc(key);
-    glutSpecialFunc(special);
-    glutIdleFunc(idle);
-    glutMouseFunc(onMouseClick);
-
-    glutSetOption ( GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION ) ;
-
+void init_context() {
+    printf("init_context\n"); fflush(stdout);
     glClearColor(1,1,1,1);
     glEnable(GL_CULL_FACE);
     glCullFace(GL_BACK);
@@ -320,6 +308,27 @@ main(int argc, char *argv[])
     glMaterialfv(GL_FRONT, GL_DIFFUSE,   mat_diffuse);
     glMaterialfv(GL_FRONT, GL_SPECULAR,  mat_specular);
     glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);
+}
+
+int
+main(int argc, char *argv[])
+{
+    glutInitWindowSize(640,480);
+    glutInitWindowPosition(40,40);
+    glutInit(&argc, argv);
+    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
+
+    glutCreateWindow("FreeGLUT Shapes");
+
+    glutReshapeFunc(resize);
+    glutDisplayFunc(display);
+    glutKeyboardFunc(key);
+    glutSpecialFunc(special);
+    glutIdleFunc(idle);
+    glutMouseFunc(onMouseClick);
+    glutInitContextFunc(init_context);
+
+    glutSetOption ( GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION ) ;
 
     glutMainLoop();