8 +# include <GL/eglew.h>
11 #if defined(GLEW_OSMESA)
13 # include <GL/osmesa.h>
14 -#elif defined(GLEW_EGL)
15 -# include <GL/eglew.h>
18 * If NOGDI is defined, wingdi.h won't be included by windows.h, and thus
21 #include <stddef.h> /* For size_t */
23 -#if defined(GLEW_EGL)
24 -#elif defined(GLEW_REGAL)
25 +#if defined(GLEW_REGAL)
27 /* In GLEW_REGAL mode we call direcly into the linked
28 libRegal.so glGetProcAddressREGAL for looking up
30 * Define glewGetProcAddress.
32 #if defined(GLEW_REGAL)
33 -# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
34 +# define _glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
35 #elif defined(GLEW_OSMESA)
36 -# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
37 -#elif defined(GLEW_EGL)
38 -# define glewGetProcAddress(name) eglGetProcAddress((const char *)name)
39 +# define _glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
41 -# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
42 +# define _glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
43 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
44 -# define glewGetProcAddress(name) NSGLGetProcAddress(name)
45 +# define _glewGetProcAddress(name) NSGLGetProcAddress(name)
46 #elif defined(__sgi) || defined(__sun) || defined(__HAIKU__)
47 -# define glewGetProcAddress(name) dlGetProcAddress(name)
48 +# define _glewGetProcAddress(name) dlGetProcAddress(name)
49 #elif defined(__ANDROID__)
50 -# define glewGetProcAddress(name) NULL /* TODO */
51 +# define _glewGetProcAddress(name) NULL /* TODO */
52 #elif defined(__native_client__)
53 -# define glewGetProcAddress(name) NULL /* TODO */
54 +# define _glewGetProcAddress(name) NULL /* TODO */
56 -# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
57 +# define _glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
60 +#if defined(GLEW_EGL)
61 +static GLboolean _EGL_available = GL_FALSE;
62 +static void (*glewGetProcAddress (const GLubyte *name)) (void)
67 + addr = eglGetProcAddress((const char *)name);
68 + if (addr) return addr;
70 + return _glewGetProcAddress(name);
73 +# define glewGetProcAddress(name) _glewGetProcAddress(name)
77 @@ -19297,9 +19312,7 @@
81 -#if defined(GLEW_OSMESA)
83 -#elif defined(GLEW_EGL)
84 +#if defined(GLEW_EGL)
86 PFNEGLCHOOSECONFIGPROC __eglewChooseConfig = NULL;
87 PFNEGLCOPYBUFFERSPROC __eglewCopyBuffers = NULL;
88 @@ -20490,8 +20503,8 @@
89 PFNEGLQUERYSTRINGPROC queryString = NULL;
91 /* Load necessary entry points */
92 - initialize = (PFNEGLINITIALIZEPROC) glewGetProcAddress("eglInitialize");
93 - queryString = (PFNEGLQUERYSTRINGPROC) glewGetProcAddress("eglQueryString");
94 + initialize = (PFNEGLINITIALIZEPROC) eglGetProcAddress("eglInitialize");
95 + queryString = (PFNEGLQUERYSTRINGPROC) eglGetProcAddress("eglQueryString");
96 if (!initialize || !queryString)
99 @@ -21029,7 +21042,9 @@
103 -#elif defined(_WIN32)
108 PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL = NULL;
110 @@ -23105,13 +23120,26 @@
112 #if defined(GLEW_EGL)
113 PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL;
114 + EGLDisplay display;
116 r = glewContextInit();
117 if ( r != 0 ) return r;
118 #if defined(GLEW_EGL)
119 - getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay");
120 - return eglewInit(getCurrentDisplay());
121 -#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
122 + getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) eglGetProcAddress("eglGetCurrentDisplay");
123 + if (getCurrentDisplay)
124 + display = getCurrentDisplay();
126 + display = EGL_NO_DISPLAY;
127 + if (display != EGL_NO_DISPLAY)
129 + r = eglewInit(display);
131 + _EGL_available = GL_TRUE;
136 +#if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
138 #elif defined(_WIN32)
140 @@ -29785,7 +29813,7 @@
144 -#if defined(_WIN32) && !defined(GLEW_EGL) && !defined(GLEW_OSMESA)
145 +#if defined(_WIN32) && !defined(GLEW_OSMESA)
147 GLboolean GLEWAPIENTRY wglewIsSupported (const char* name)
149 @@ -30228,7 +30256,7 @@
153 -#elif !defined(GLEW_OSMESA) && !defined(GLEW_EGL) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
154 +#elif !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
156 GLboolean glxewIsSupported (const char* name)
158 @@ -30805,7 +30833,9 @@
162 -#elif defined(GLEW_EGL)
165 +#if defined(GLEW_EGL)
167 GLboolean eglewIsSupported (const char* name)