From 8c3eab0efb7f82a94014e0c1342c287e19461041 Mon Sep 17 00:00:00 2001 From: Sylvain Beucler Date: Tue, 1 May 2012 10:37:06 +0000 Subject: [PATCH] fg_geometry: remove GLES-specific #ifdefs (in code and headers), update Android test-case. GL2 code compiles but does not work yet. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1274 7f0cb862-5218-0410-a997-914c9d46530a --- include/GL/freeglut_ext.h | 5 ----- include/GL/freeglut_std.h | 5 ----- progs/test-shapes-gles1/test-shapes-gles1.c | 24 ++++++++++++++++-------- src/fg_ext.c | 6 +----- src/fg_geometry.c | 6 ------ 5 files changed, 17 insertions(+), 29 deletions(-) diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 82dcc0a..d6b564d 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -163,17 +163,12 @@ FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *stri /* * Geometry functions, see freeglut_geometry.c */ -#ifndef GL_ES_VERSION_2_0 FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void ); FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void ); -#endif - FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale ); FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale ); -#ifndef GL_ES_VERSION_2_0 FGAPI void FGAPIENTRY glutWireCylinder( double radius, double height, GLint slices, GLint stacks); FGAPI void FGAPIENTRY glutSolidCylinder( double radius, double height, GLint slices, GLint stacks); -#endif /* * Extension functions, see freeglut_ext.c diff --git a/include/GL/freeglut_std.h b/include/GL/freeglut_std.h index 2669006..23e6806 100644 --- a/include/GL/freeglut_std.h +++ b/include/GL/freeglut_std.h @@ -527,15 +527,10 @@ FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* stri FGAPI void FGAPIENTRY glutWireCube( double size ); FGAPI void FGAPIENTRY glutSolidCube( double size ); -#ifndef GL_ES_VERSION_2_0 FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks ); FGAPI void FGAPIENTRY glutSolidSphere( double radius, GLint slices, GLint stacks ); -#endif -#ifndef EGL_VERSION_1_0 FGAPI void FGAPIENTRY glutWireCone( double base, double height, GLint slices, GLint stacks ); FGAPI void FGAPIENTRY glutSolidCone( double base, double height, GLint slices, GLint stacks ); -#endif - FGAPI void FGAPIENTRY glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings ); FGAPI void FGAPIENTRY glutSolidTorus( double innerRadius, double outerRadius, GLint sides, GLint rings ); FGAPI void FGAPIENTRY glutWireDodecahedron( void ); diff --git a/progs/test-shapes-gles1/test-shapes-gles1.c b/progs/test-shapes-gles1/test-shapes-gles1.c index b22cb7f..56b3569 100644 --- a/progs/test-shapes-gles1/test-shapes-gles1.c +++ b/progs/test-shapes-gles1/test-shapes-gles1.c @@ -70,6 +70,7 @@ static double offset[ 3 ] = { 0, 0, 0 }; static GLboolean show_info = GL_TRUE; static float ar; static GLboolean persProject = GL_TRUE; +static GLboolean animateXRot = GL_FALSE; /* * These one-liners draw particular objects, fetching appropriate @@ -90,16 +91,14 @@ static void drawSolidIcosahedron(void) { glutSolidIcosahedron (); static void drawWireIcosahedron(void) { glutWireIcosahedron (); } static void drawSolidSierpinskiSponge(void) { glutSolidSierpinskiSponge (depth, offset, orad);} /* orad doubles as size input */ static void drawWireSierpinskiSponge(void) { glutWireSierpinskiSponge (depth, offset, orad); } /* orad doubles as size input */ -static void drawSolidSphere(void) { glutSolidSphere(orad,slices,stacks); } /* orad doubles as size input */ -static void drawWireSphere(void) { glutWireSphere(orad,slices,stacks); } /* orad doubles as size input */ -#ifndef EGL_VERSION_1_0 static void drawSolidTorus(void) { glutSolidTorus(irad,orad,slices,stacks); } static void drawWireTorus(void) { glutWireTorus (irad,orad,slices,stacks); } +static void drawSolidSphere(void) { glutSolidSphere(orad,slices,stacks); } /* orad doubles as size input */ +static void drawWireSphere(void) { glutWireSphere(orad,slices,stacks); } /* orad doubles as size input */ static void drawSolidCone(void) { glutSolidCone(orad,orad,slices,stacks); } /* orad doubles as size input */ 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 */ -#endif /* * This structure defines an entry in our function-table. @@ -114,14 +113,19 @@ typedef struct #define ENTRY(e) {#e, drawSolid##e, drawWire##e} static const entry table [] = { - ENTRY (Cube), ENTRY (Tetrahedron), + ENTRY (Cube), ENTRY (Octahedron), ENTRY (Dodecahedron), ENTRY (RhombicDodecahedron), ENTRY (Icosahedron), ENTRY (SierpinskiSponge), + /* ENTRY (Teapot), */ + ENTRY (Torus), ENTRY (Sphere), + ENTRY (Cone), + ENTRY (Cylinder), + /* ENTRY (Cuboctahedron) */ }; #undef ENTRY @@ -151,6 +155,7 @@ static void display(void) { const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; const double a = t*90.0; + const double b = (animateXRot?t:1)*60.0; glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -166,14 +171,14 @@ static void display(void) glPushMatrix(); glTranslated(0,1.2,-6); - glRotated(60,1,0,0); + glRotated(b,1,0,0); glRotated(a,0,0,1); table [function_index].solid (); glPopMatrix(); glPushMatrix(); glTranslated(0,-1.2,-6); - glRotated(60,1,0,0); + glRotated(b,1,0,0); glRotated(a,0,0,1); table [function_index].wire (); glPopMatrix(); @@ -218,6 +223,9 @@ key(unsigned char key, int x, int y) case 'P': case 'p': persProject=!persProject; break; + case 'R': + case 'r': animateXRot=!animateXRot; break; + default: break; } @@ -258,7 +266,7 @@ idle(void) static void onMouseClick(int button, int state, int x, int y) { if (state == GLUT_DOWN) - special(GLUT_KEY_PAGE_DOWN, 0, 0); + special(GLUT_KEY_PAGE_UP, 0, 0); } const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f }; diff --git a/src/fg_ext.c b/src/fg_ext.c index 82b6304..344fa51 100644 --- a/src/fg_ext.c +++ b/src/fg_ext.c @@ -126,17 +126,15 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName ) CHECK_NAME(glutStrokeWidth); CHECK_NAME(glutBitmapLength); CHECK_NAME(glutStrokeLength); -#ifndef GL_ES_VERSION_2_0 CHECK_NAME(glutWireSphere); CHECK_NAME(glutSolidSphere); -#endif -#ifndef EGL_VERSION_1_0 CHECK_NAME(glutWireCone); CHECK_NAME(glutSolidCone); CHECK_NAME(glutWireTorus); CHECK_NAME(glutSolidTorus); CHECK_NAME(glutWireCylinder); CHECK_NAME(glutSolidCylinder); +#ifndef EGL_VERSION_1_0 CHECK_NAME(glutWireTeapot); CHECK_NAME(glutSolidTeapot); #endif @@ -150,10 +148,8 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName ) CHECK_NAME(glutSolidTetrahedron); CHECK_NAME(glutWireIcosahedron); CHECK_NAME(glutSolidIcosahedron); -#ifndef EGL_VERSION_1_0 CHECK_NAME(glutWireRhombicDodecahedron); CHECK_NAME(glutSolidRhombicDodecahedron); -#endif CHECK_NAME(glutWireSierpinskiSponge); CHECK_NAME(glutSolidSierpinskiSponge); CHECK_NAME(glutVideoResizeGet); diff --git a/src/fg_geometry.c b/src/fg_geometry.c index 3e47e95..f9c5f62 100644 --- a/src/fg_geometry.c +++ b/src/fg_geometry.c @@ -790,7 +790,6 @@ static void fghSierpinskiSpongeGenerate ( int numLevels, double offset[3], GLflo } } -#ifndef GL_ES_VERSION_2_0 /* -- Now the various shapes involving circles -- */ /* * Compute lookup table of cos and sin values forming a circle @@ -1187,7 +1186,6 @@ void fghGenerateTorus( free(sphi); free(cphi); } -#endif /* -- INTERNAL DRAWING functions --------------------------------------- */ #define _DECLARE_INTERNAL_DRAW_DO_DECLARE(name,nameICaps,nameCaps,vertIdxs)\ @@ -1301,7 +1299,6 @@ static void fghSierpinskiSponge ( int numLevels, double offset[3], GLfloat scale } -#ifndef GL_ES_VERSION_2_0 static void fghSphere( double radius, GLint slices, GLint stacks, GLboolean useWireMode ) { int i,j,idx, nVert; @@ -1777,9 +1774,7 @@ void FGAPIENTRY glutWireSphere(double radius, GLint slices, GLint stacks) fghSphere( radius, slices, stacks, TRUE ); } -#endif /* GL_ES_VERSION_2_0 */ -#ifndef EGL_VERSION_1_0 /* * Draws a solid cone */ @@ -1840,7 +1835,6 @@ void FGAPIENTRY glutSolidTorus( double dInnerRadius, double dOuterRadius, GLint fghTorus(dInnerRadius, dOuterRadius, nSides, nRings, FALSE); } -#endif /* EGL_VERSION_1_0 */ -- 1.7.10.4