Initial #ifdef __ANDROID__ support for the GLEW build.

This commit is contained in:
Nigel Stewart 2012-05-04 14:15:10 -05:00
parent 7b600b4aac
commit e81e12ded0
3 changed files with 21 additions and 14 deletions

View File

@ -1,7 +1,8 @@
#include <GL/glew.h>
#if defined(_WIN32)
# include <GL/wglew.h>
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
# include <GL/glxew.h>
#endif
@ -72,7 +73,11 @@ void* NSGLGetProcAddress (const GLubyte *name)
void* addr;
if (NULL == image)
{
#ifdef GLEW_REGAL
image = dlopen("libRegal.dylib", RTLD_LAZY);
#else
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
#endif
}
if( !image ) return NULL;
addr = dlsym(image, (const char*)name);
@ -94,7 +99,11 @@ void* NSGLGetProcAddress (const GLubyte *name)
char* symbolName;
if (NULL == image)
{
#ifdef GLEW_REGAL
image = NSAddImage("libRegal.dylib", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
#else
image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
#endif
}
/* prepend a '_' for the Unix C symbol mangling convention */
symbolName = malloc(strlen((const char*)name) + 2);
@ -120,16 +129,14 @@ void* NSGLGetProcAddress (const GLubyte *name)
*/
#if defined(_WIN32)
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#else
# if defined(__APPLE__)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
# else
# if defined(__sgi) || defined(__sun)
#elif defined(__sgi) || defined(__sun)
# define glewGetProcAddress(name) dlGetProcAddress(name)
# else /* __linux */
#elif defined(__ANDROID__)
# define glewGetProcAddress(name) NULL /* TODO */
#else /* __linux */
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
# endif
# endif
#endif
/*

View File

@ -36,7 +36,7 @@ GLboolean glewExperimental = GL_FALSE;
#if defined(_WIN32)
extern GLenum wglewContextInit (void);
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
extern GLenum glxewContextInit (void);
#endif /* _WIN32 */
@ -47,7 +47,7 @@ GLenum glewInit (void)
if ( r != 0 ) return r;
#if defined(_WIN32)
return wglewContextInit();
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
return glxewContextInit();
#else
return r;

View File

@ -32,7 +32,7 @@
#include <GL/glew.h>
#if defined(_WIN32)
# include <GL/wglew.h>
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
# include <GL/glxew.h>
#endif