mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-29 09:11:56 +00:00
Initial #ifdef __ANDROID__ support for the GLEW build.
This commit is contained in:
parent
7b600b4aac
commit
e81e12ded0
@ -1,7 +1,8 @@
|
|||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# include <GL/wglew.h>
|
# include <GL/wglew.h>
|
||||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
|
||||||
# include <GL/glxew.h>
|
# include <GL/glxew.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -72,7 +73,11 @@ void* NSGLGetProcAddress (const GLubyte *name)
|
|||||||
void* addr;
|
void* addr;
|
||||||
if (NULL == image)
|
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);
|
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if( !image ) return NULL;
|
if( !image ) return NULL;
|
||||||
addr = dlsym(image, (const char*)name);
|
addr = dlsym(image, (const char*)name);
|
||||||
@ -94,7 +99,11 @@ void* NSGLGetProcAddress (const GLubyte *name)
|
|||||||
char* symbolName;
|
char* symbolName;
|
||||||
if (NULL == image)
|
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);
|
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 */
|
/* prepend a '_' for the Unix C symbol mangling convention */
|
||||||
symbolName = malloc(strlen((const char*)name) + 2);
|
symbolName = malloc(strlen((const char*)name) + 2);
|
||||||
@ -120,16 +129,14 @@ void* NSGLGetProcAddress (const GLubyte *name)
|
|||||||
*/
|
*/
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
|
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
|
||||||
#else
|
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
|
||||||
# if defined(__APPLE__)
|
|
||||||
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
|
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
|
||||||
# else
|
#elif defined(__sgi) || defined(__sun)
|
||||||
# if defined(__sgi) || defined(__sun)
|
|
||||||
# define glewGetProcAddress(name) dlGetProcAddress(name)
|
# define glewGetProcAddress(name) dlGetProcAddress(name)
|
||||||
# else /* __linux */
|
#elif defined(__ANDROID__)
|
||||||
|
# define glewGetProcAddress(name) NULL /* TODO */
|
||||||
|
#else /* __linux */
|
||||||
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
|
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +36,7 @@ GLboolean glewExperimental = GL_FALSE;
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
extern GLenum wglewContextInit (void);
|
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);
|
extern GLenum glxewContextInit (void);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ GLenum glewInit (void)
|
|||||||
if ( r != 0 ) return r;
|
if ( r != 0 ) return r;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
return wglewContextInit();
|
return wglewContextInit();
|
||||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
|
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
|
||||||
return glxewContextInit();
|
return glxewContextInit();
|
||||||
#else
|
#else
|
||||||
return r;
|
return r;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# include <GL/wglew.h>
|
# include <GL/wglew.h>
|
||||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
#elif !defined(__ANDROID__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
|
||||||
# include <GL/glxew.h>
|
# include <GL/glxew.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user