From: Sylvain Beucler Date: Fri, 23 Mar 2012 01:02:57 +0000 (+0000) Subject: - Document what works with GLES1 and GLES2 as of now X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=e299df837915eaaf97e8e4ccbcb75bf1876661da;p=freeglut - Document what works with GLES1 and GLES2 as of now - Conditionaly disable what doesn't work so that libfreeglut can be compiled as-is for GLES1 and GLES2 (Android and Mesa EGL) - These #ifdef's are meant to disappear as more functions are implemented for GLES git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1201 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f0b146..7a7de9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,13 +62,13 @@ SET(FREEGLUT_SRCS IF(NOT FREEGLUT_GLES2 AND NOT FREEGLUT_GLES1) LIST(APPEND FREEGLUT_SRCS src/fg_font.c - src/fg_geometry.c src/fg_menu.c src/fg_teapot.c src/fg_teapot_data.h ) ELSE() LIST(APPEND FREEGLUT_SRCS + src/fg_geometry.c src/gles_stubs.c ) ENDIF() diff --git a/include/GL/freeglut_ext.h b/include/GL/freeglut_ext.h index 1eee142..0a91166 100644 --- a/include/GL/freeglut_ext.h +++ b/include/GL/freeglut_ext.h @@ -161,6 +161,7 @@ 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 ); @@ -168,6 +169,7 @@ FGAPI void FGAPIENTRY glutWireSierpinskiSponge ( int num_levels, double offse FGAPI void FGAPIENTRY glutSolidSierpinskiSponge ( int num_levels, double offset[3], double scale ); 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 ab1be03..9667ccf 100644 --- a/include/GL/freeglut_std.h +++ b/include/GL/freeglut_std.h @@ -525,13 +525,18 @@ FGAPI int FGAPIENTRY glutStrokeLength( void* font, const unsigned char* stri * Geometry functions, see freeglut_geometry.c */ +#ifndef GL_ES_VERSION_2_0 FGAPI void FGAPIENTRY glutWireCube( double size ); FGAPI void FGAPIENTRY glutSolidCube( double size ); +#endif +#ifndef EGL_VERSION_1_0 FGAPI void FGAPIENTRY glutWireSphere( double radius, GLint slices, GLint stacks ); FGAPI void FGAPIENTRY glutSolidSphere( double radius, 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 ); +#endif +#ifndef GL_ES_VERSION_2_0 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 ); @@ -542,12 +547,16 @@ FGAPI void FGAPIENTRY glutWireTetrahedron( void ); FGAPI void FGAPIENTRY glutSolidTetrahedron( void ); FGAPI void FGAPIENTRY glutWireIcosahedron( void ); FGAPI void FGAPIENTRY glutSolidIcosahedron( void ); +#endif /* * Teapot rendering functions, found in freeglut_teapot.c */ +/* TODO: doesn't work with GLES1 yet */ +#ifndef EGL_VERSION_1_0 FGAPI void FGAPIENTRY glutWireTeapot( double size ); FGAPI void FGAPIENTRY glutSolidTeapot( double size ); +#endif /* * Game mode functions, see freeglut_gamemode.c diff --git a/src/fg_ext.c b/src/fg_ext.c index a9a8a11..6d50717 100644 --- a/src/fg_ext.c +++ b/src/fg_ext.c @@ -126,24 +126,34 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName ) CHECK_NAME(glutStrokeWidth); CHECK_NAME(glutBitmapLength); CHECK_NAME(glutStrokeLength); +#ifndef EGL_VERSION_1_0 CHECK_NAME(glutWireSphere); CHECK_NAME(glutSolidSphere); CHECK_NAME(glutWireCone); CHECK_NAME(glutSolidCone); - CHECK_NAME(glutWireCube); - CHECK_NAME(glutSolidCube); CHECK_NAME(glutWireTorus); CHECK_NAME(glutSolidTorus); - CHECK_NAME(glutWireDodecahedron); - CHECK_NAME(glutSolidDodecahedron); + CHECK_NAME(glutWireCylinder); + CHECK_NAME(glutSolidCylinder); CHECK_NAME(glutWireTeapot); CHECK_NAME(glutSolidTeapot); +#endif +#ifndef GL_ES_VERSION_2_0 + CHECK_NAME(glutWireCube); + CHECK_NAME(glutSolidCube); + CHECK_NAME(glutWireDodecahedron); + CHECK_NAME(glutSolidDodecahedron); CHECK_NAME(glutWireOctahedron); CHECK_NAME(glutSolidOctahedron); CHECK_NAME(glutWireTetrahedron); CHECK_NAME(glutSolidTetrahedron); CHECK_NAME(glutWireIcosahedron); CHECK_NAME(glutSolidIcosahedron); + CHECK_NAME(glutWireRhombicDodecahedron); + CHECK_NAME(glutSolidRhombicDodecahedron); + CHECK_NAME(glutWireSierpinskiSponge); + CHECK_NAME(glutSolidSierpinskiSponge); +#endif CHECK_NAME(glutVideoResizeGet); CHECK_NAME(glutSetupVideoResizing); CHECK_NAME(glutStopVideoResizing); @@ -171,12 +181,6 @@ static GLUTproc fghGetGLUTProcAddress( const char* procName ) CHECK_NAME(glutStrokeHeight); CHECK_NAME(glutBitmapString); CHECK_NAME(glutStrokeString); - CHECK_NAME(glutWireRhombicDodecahedron); - CHECK_NAME(glutSolidRhombicDodecahedron); - CHECK_NAME(glutWireSierpinskiSponge); - CHECK_NAME(glutSolidSierpinskiSponge); - CHECK_NAME(glutWireCylinder); - CHECK_NAME(glutSolidCylinder); CHECK_NAME(glutGetProcAddress); CHECK_NAME(glutMouseWheelFunc); CHECK_NAME(glutJoystickGetNumAxes); diff --git a/src/fg_geometry.c b/src/fg_geometry.c index 01e76fc..2e0a3b3 100644 --- a/src/fg_geometry.c +++ b/src/fg_geometry.c @@ -33,6 +33,7 @@ */ +#ifndef GL_ES_VERSION_2_0 /* General functions for drawing geometry * Solids are drawn by glDrawArrays if composed of triangles, or by * glDrawElements if consisting of squares or pentagons that were @@ -725,11 +726,13 @@ static void fghSierpinskiSponge ( int numLevels, double offset[3], GLfloat scale free(normals ); } } +#endif /* GL_ES_VERSION_2_0 */ /* -- INTERFACE FUNCTIONS ---------------------------------------------- */ +#ifndef EGL_VERSION_1_0 /* * Draws a solid sphere */ @@ -1324,6 +1327,7 @@ void FGAPIENTRY glutSolidTorus( double dInnerRadius, double dOuterRadius, GLint free ( normal ) ; glPopMatrix(); } +#endif /* EGL_VERSION_1_0 */ diff --git a/src/gles_stubs.c b/src/gles_stubs.c index 164219c..703e7d2 100644 --- a/src/gles_stubs.c +++ b/src/gles_stubs.c @@ -1,3 +1,5 @@ +/* TODO: implement me! */ + #include #include "fg_internal.h" @@ -14,3 +16,33 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed, int mouse_x, int mouse_y ) { fprintf(stderr, "fgCheckActiveMenu: STUB\n"); } + +int glutCreateMenu( void (* callback)( int menu ) ) {} +void glutDestroyMenu( int menu ) {} +int glutGetMenu( void ) {} +void glutSetMenu( int menu ) {} +void glutAddMenuEntry( const char* label, int value ) {} +void glutAddSubMenu( const char* label, int subMenu ) {} +void glutChangeToMenuEntry( int item, const char* label, int value ) {} +void glutChangeToSubMenu( int item, const char* label, int value ) {} +void glutRemoveMenuItem( int item ) {} +void glutAttachMenu( int button ) {} +void glutDetachMenu( int button ) {} + +void glutBitmapCharacter( void* font, int character ) {} +int glutBitmapWidth( void* font, int character ) {} +void glutStrokeCharacter( void* font, int character ) {} +int glutStrokeWidth( void* font, int character ) {} +int glutBitmapLength( void* font, const unsigned char* string ) {} +int glutStrokeLength( void* font, const unsigned char* string ) {} + +void *glutGetMenuData( void ) {} +void glutSetMenuData(void* data) {} + +int glutBitmapHeight( void* font ) {} +GLfloat glutStrokeHeight( void* font ) {} +void glutBitmapString( void* font, const unsigned char *string ) {} +void glutStrokeString( void* font, const unsigned char *string ) {} + +void glutWireTeapot( double size ){} +void glutSolidTeapot( double size ){}