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: https://svn.code.sf.net/p/freeglut/code/trunk@1274 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
beuc 2012-05-01 10:37:06 +00:00
parent dad750d1df
commit 104a238a57
5 changed files with 17 additions and 29 deletions

View File

@ -163,17 +163,12 @@ FGAPI void FGAPIENTRY glutStrokeString( void* font, const unsigned char *stri
/* /*
* Geometry functions, see freeglut_geometry.c * Geometry functions, see freeglut_geometry.c
*/ */
#ifndef GL_ES_VERSION_2_0
FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void ); FGAPI void FGAPIENTRY glutWireRhombicDodecahedron( void );
FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void ); FGAPI void FGAPIENTRY glutSolidRhombicDodecahedron( void );
#endif
FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale ); FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offset[3], double scale );
FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( 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 glutWireCylinder( double radius, double height, GLint slices, GLint stacks);
FGAPI void FGAPIENTRY glutSolidCylinder( 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 * Extension functions, see freeglut_ext.c

View File

@ -527,15 +527,10 @@ FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* stri
FGAPI void FGAPIENTRY glutWireCube( double size ); FGAPI void FGAPIENTRY glutWireCube( double size );
FGAPI void FGAPIENTRY glutSolidCube( 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 glutWireSphere( double radius, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidSphere( 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 glutWireCone( double base, double height, GLint slices, GLint stacks );
FGAPI void FGAPIENTRY glutSolidCone( 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 glutWireTorus( double innerRadius, double outerRadius, GLint sides, GLint rings );
FGAPI void FGAPIENTRY glutSolidTorus( 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 ); FGAPI void FGAPIENTRY glutWireDodecahedron( void );

View File

@ -70,6 +70,7 @@ static double offset[ 3 ] = { 0, 0, 0 };
static GLboolean show_info = GL_TRUE; static GLboolean show_info = GL_TRUE;
static float ar; static float ar;
static GLboolean persProject = GL_TRUE; static GLboolean persProject = GL_TRUE;
static GLboolean animateXRot = GL_FALSE;
/* /*
* These one-liners draw particular objects, fetching appropriate * These one-liners draw particular objects, fetching appropriate
@ -90,16 +91,14 @@ static void drawSolidIcosahedron(void) { glutSolidIcosahedron ();
static void drawWireIcosahedron(void) { glutWireIcosahedron (); } static void drawWireIcosahedron(void) { glutWireIcosahedron (); }
static void drawSolidSierpinskiSponge(void) { glutSolidSierpinskiSponge (depth, offset, orad);} /* orad doubles as size input */ 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 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 drawSolidTorus(void) { glutSolidTorus(irad,orad,slices,stacks); }
static void drawWireTorus(void) { glutWireTorus (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 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 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 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 drawWireCylinder(void) { glutWireCylinder(orad,orad,slices,stacks); } /* orad doubles as size input */
#endif
/* /*
* This structure defines an entry in our function-table. * This structure defines an entry in our function-table.
@ -114,14 +113,19 @@ typedef struct
#define ENTRY(e) {#e, drawSolid##e, drawWire##e} #define ENTRY(e) {#e, drawSolid##e, drawWire##e}
static const entry table [] = static const entry table [] =
{ {
ENTRY (Cube),
ENTRY (Tetrahedron), ENTRY (Tetrahedron),
ENTRY (Cube),
ENTRY (Octahedron), ENTRY (Octahedron),
ENTRY (Dodecahedron), ENTRY (Dodecahedron),
ENTRY (RhombicDodecahedron), ENTRY (RhombicDodecahedron),
ENTRY (Icosahedron), ENTRY (Icosahedron),
ENTRY (SierpinskiSponge), ENTRY (SierpinskiSponge),
/* ENTRY (Teapot), */
ENTRY (Torus),
ENTRY (Sphere), ENTRY (Sphere),
ENTRY (Cone),
ENTRY (Cylinder),
/* ENTRY (Cuboctahedron) */
}; };
#undef ENTRY #undef ENTRY
@ -151,6 +155,7 @@ static void display(void)
{ {
const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
const double a = t*90.0; const double a = t*90.0;
const double b = (animateXRot?t:1)*60.0;
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
@ -166,14 +171,14 @@ static void display(void)
glPushMatrix(); glPushMatrix();
glTranslated(0,1.2,-6); glTranslated(0,1.2,-6);
glRotated(60,1,0,0); glRotated(b,1,0,0);
glRotated(a,0,0,1); glRotated(a,0,0,1);
table [function_index].solid (); table [function_index].solid ();
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
glTranslated(0,-1.2,-6); glTranslated(0,-1.2,-6);
glRotated(60,1,0,0); glRotated(b,1,0,0);
glRotated(a,0,0,1); glRotated(a,0,0,1);
table [function_index].wire (); table [function_index].wire ();
glPopMatrix(); glPopMatrix();
@ -218,6 +223,9 @@ key(unsigned char key, int x, int y)
case 'P': case 'P':
case 'p': persProject=!persProject; break; case 'p': persProject=!persProject; break;
case 'R':
case 'r': animateXRot=!animateXRot; break;
default: default:
break; break;
} }
@ -258,7 +266,7 @@ idle(void)
static void static void
onMouseClick(int button, int state, int x, int y) { onMouseClick(int button, int state, int x, int y) {
if (state == GLUT_DOWN) 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 }; const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };

View File

@ -126,17 +126,15 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
CHECK_NAME(glutStrokeWidth); CHECK_NAME(glutStrokeWidth);
CHECK_NAME(glutBitmapLength); CHECK_NAME(glutBitmapLength);
CHECK_NAME(glutStrokeLength); CHECK_NAME(glutStrokeLength);
#ifndef GL_ES_VERSION_2_0
CHECK_NAME(glutWireSphere); CHECK_NAME(glutWireSphere);
CHECK_NAME(glutSolidSphere); CHECK_NAME(glutSolidSphere);
#endif
#ifndef EGL_VERSION_1_0
CHECK_NAME(glutWireCone); CHECK_NAME(glutWireCone);
CHECK_NAME(glutSolidCone); CHECK_NAME(glutSolidCone);
CHECK_NAME(glutWireTorus); CHECK_NAME(glutWireTorus);
CHECK_NAME(glutSolidTorus); CHECK_NAME(glutSolidTorus);
CHECK_NAME(glutWireCylinder); CHECK_NAME(glutWireCylinder);
CHECK_NAME(glutSolidCylinder); CHECK_NAME(glutSolidCylinder);
#ifndef EGL_VERSION_1_0
CHECK_NAME(glutWireTeapot); CHECK_NAME(glutWireTeapot);
CHECK_NAME(glutSolidTeapot); CHECK_NAME(glutSolidTeapot);
#endif #endif
@ -150,10 +148,8 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName )
CHECK_NAME(glutSolidTetrahedron); CHECK_NAME(glutSolidTetrahedron);
CHECK_NAME(glutWireIcosahedron); CHECK_NAME(glutWireIcosahedron);
CHECK_NAME(glutSolidIcosahedron); CHECK_NAME(glutSolidIcosahedron);
#ifndef EGL_VERSION_1_0
CHECK_NAME(glutWireRhombicDodecahedron); CHECK_NAME(glutWireRhombicDodecahedron);
CHECK_NAME(glutSolidRhombicDodecahedron); CHECK_NAME(glutSolidRhombicDodecahedron);
#endif
CHECK_NAME(glutWireSierpinskiSponge); CHECK_NAME(glutWireSierpinskiSponge);
CHECK_NAME(glutSolidSierpinskiSponge); CHECK_NAME(glutSolidSierpinskiSponge);
CHECK_NAME(glutVideoResizeGet); CHECK_NAME(glutVideoResizeGet);

View File

@ -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 -- */ /* -- Now the various shapes involving circles -- */
/* /*
* Compute lookup table of cos and sin values forming a circle * Compute lookup table of cos and sin values forming a circle
@ -1187,7 +1186,6 @@ void fghGenerateTorus(
free(sphi); free(sphi);
free(cphi); free(cphi);
} }
#endif
/* -- INTERNAL DRAWING functions --------------------------------------- */ /* -- INTERNAL DRAWING functions --------------------------------------- */
#define _DECLARE_INTERNAL_DRAW_DO_DECLARE(name,nameICaps,nameCaps,vertIdxs)\ #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 ) static void fghSphere( double radius, GLint slices, GLint stacks, GLboolean useWireMode )
{ {
int i,j,idx, nVert; int i,j,idx, nVert;
@ -1777,9 +1774,7 @@ void FGAPIENTRY glutWireSphere(double radius, GLint slices, GLint stacks)
fghSphere( radius, slices, stacks, TRUE ); fghSphere( radius, slices, stacks, TRUE );
} }
#endif /* GL_ES_VERSION_2_0 */
#ifndef EGL_VERSION_1_0
/* /*
* Draws a solid cone * Draws a solid cone
*/ */
@ -1840,7 +1835,6 @@ void FGAPIENTRY glutSolidTorus( double dInnerRadius, double dOuterRadius, GLint
fghTorus(dInnerRadius, dOuterRadius, nSides, nRings, FALSE); fghTorus(dInnerRadius, dOuterRadius, nSides, nRings, FALSE);
} }
#endif /* EGL_VERSION_1_0 */