Support GLES headers

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1104 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
beuc 2012-03-11 09:30:51 +00:00
parent eb37483010
commit 402c9871eb
4 changed files with 22 additions and 0 deletions

View File

@ -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 <EGL/egl.h>
/* TODO: we probably need 2 builds: -lGLESv1 and -lGLESv2 */
/* #include <GLES/gl.h> */
#include <GLES2/gl2.h>
/* TODO: temporary work-around for e.g. glutWireCube */
#define GLdouble GLfloat
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
/*
* GLUT API macro definitions -- the special key codes:

View File

@ -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 ---------------------------------------------- */

View File

@ -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";

View File

@ -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
}
/*