From: Sylvain Beucler Date: Sun, 11 Mar 2012 09:30:51 +0000 (+0000) Subject: Support GLES headers X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=6b975bfa34c872ed3287967a385b1f193da99097;p=freeglut Support GLES headers git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1104 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/include/GL/freeglut_std.h b/include/GL/freeglut_std.h index ba1b716..d1cd23f 100644 --- a/include/GL/freeglut_std.h +++ b/include/GL/freeglut_std.h @@ -119,8 +119,20 @@ /* * Always include OpenGL and GLU headers */ +#ifdef ANDROID +/* Use EGL (implies OpenGL ES) */ +/* TODO: EGL/GLES builds should be more generally defined, possibly by + generating this file dynamically */ +#include +/* TODO: we probably need 2 builds: -lGLESv1 and -lGLESv2 */ +/* #include */ +#include +/* TODO: temporary work-around for e.g. glutWireCube */ +#define GLdouble GLfloat +#else #include #include +#endif /* * GLUT API macro definitions -- the special key codes: diff --git a/src/Common/freeglut_internal.h b/src/Common/freeglut_internal.h index 415b9a4..aab598f 100644 --- a/src/Common/freeglut_internal.h +++ b/src/Common/freeglut_internal.h @@ -47,6 +47,9 @@ || ( defined(__CYGWIN__) && defined(X_DISPLAY_MISSING) ) # define TARGET_HOST_MS_WINDOWS 1 +#elif defined (ANDROID) +# define TARGET_HOST_ANDROID 1 + #elif defined(__posix__) || defined(__unix__) || defined(__linux__) || defined(__sun) # define TARGET_HOST_POSIX_X11 1 @@ -163,6 +166,9 @@ #if TARGET_HOST_MS_WINDOWS #include "../mswin/freeglut_internal_mswin.h" #endif +#if TARGET_HOST_ANDROID +#include "../android/freeglut_internal_android.h" +#endif /* -- GLOBAL TYPE DEFINITIONS ---------------------------------------------- */ diff --git a/src/Common/freeglut_misc.c b/src/Common/freeglut_misc.c index 18dab12..b0beb39 100644 --- a/src/Common/freeglut_misc.c +++ b/src/Common/freeglut_misc.c @@ -109,8 +109,10 @@ static const char* fghErrorString( GLenum error ) case GL_INVALID_ENUM: return "invalid enumerant"; case GL_INVALID_VALUE: return "invalid value"; case GL_INVALID_OPERATION: return "invalid operation"; +#ifndef GL_ES_VERSION_2_0 case GL_STACK_OVERFLOW: return "stack overflow"; case GL_STACK_UNDERFLOW: return "stack underflow"; +#endif case GL_OUT_OF_MEMORY: return "out of memory"; case GL_TABLE_TOO_LARGE: return "table too large"; case GL_INVALID_FRAMEBUFFER_OPERATION: return "invalid framebuffer operation"; diff --git a/src/Common/freeglut_window.c b/src/Common/freeglut_window.c index 5a29a27..bcbe44d 100644 --- a/src/Common/freeglut_window.c +++ b/src/Common/freeglut_window.c @@ -145,11 +145,13 @@ void fgOpenWindow( SFG_Window* window, const char* title, window->Window.DoubleBuffered = ( fgState.DisplayMode & GLUT_DOUBLE ) ? 1 : 0; +#ifndef EGL_VERSION_1_0 /* No glDrawBuffer/glReadBuffer in GLES */ if ( ! window->Window.DoubleBuffered ) { glDrawBuffer ( GL_FRONT ); glReadBuffer ( GL_FRONT ); } +#endif } /*