A GitLab update will be applied today, 9/24. The site may be slow between 12pm - 12:45pm Fri 9/24 EDT (UTC -400).

Commit e81e12de authored by Nigel Stewart's avatar Nigel Stewart
Browse files

Initial #ifdef __ANDROID__ support for the GLEW build.

parent 7b600b4a
#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__)
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
# else
# if defined(__sgi) || defined(__sun)
# define glewGetProcAddress(name) dlGetProcAddress(name)
# else /* __linux */
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
# endif
# endif
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
#elif defined(__sgi) || defined(__sun)
# define glewGetProcAddress(name) dlGetProcAddress(name)
#elif defined(__ANDROID__)
# define glewGetProcAddress(name) NULL /* TODO */
#else /* __linux */
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
#endif
/*
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment