diff --git a/auto/Makefile b/auto/Makefile index 61cc6c9..327ba9b 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -300,6 +300,8 @@ $(S.DEST)/glewinfo.c: $(EXT)/.dummy $(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@ $(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@ echo -e "#if defined(GLEW_EGL)\n" >> $@ + $(BIN)/make_info.pl $(EGL_CORE_SPEC) >> $@ + $(BIN)/make_info.pl $(EGL_EXT_SPEC) >> $@ echo -e "#elif _WIN32\n" >> $@ $(BIN)/make_info.pl $(WGL_EXT_SPEC) >> $@ echo -e "#else /* _UNIX */\n" >> $@ diff --git a/auto/bin/make_str.pl b/auto/bin/make_str.pl index 5b83ef8..6673a80 100755 --- a/auto/bin/make_str.pl +++ b/auto/bin/make_str.pl @@ -24,11 +24,11 @@ if (@ARGV) { my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext); my $exttype = $extname; - $exttype =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$3/; + $exttype =~ s/(W?E?)GL(X?)_(.*?_)(.*)/$3/; my $extrem = $extname; - $extrem =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$4/; + $extrem =~ s/(W?E?)GL(X?)_(.*?_)(.*)/$4/; my $extvar = $extname; - $extvar =~ s/(W*)GL(X*)_/$1GL$2EW_/; + $extvar =~ s/(W?E?)GL(X?)_/$1GL$2EW_/; if(!($exttype =~ $curexttype)) { if(length($curexttype) > 0) diff --git a/auto/src/eglew_head.h b/auto/src/eglew_head.h index f0ec663..bb95b1a 100644 --- a/auto/src/eglew_head.h +++ b/auto/src/eglew_head.h @@ -66,6 +66,8 @@ typedef khronos_utime_nanoseconds_t EGLuint64NV; struct EGLClientPixmapHI; +#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) + EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); #ifdef __cplusplus diff --git a/auto/src/glew_init_egl.c b/auto/src/glew_init_egl.c index e2e481a..44453c3 100644 --- a/auto/src/glew_init_egl.c +++ b/auto/src/glew_init_egl.c @@ -5,27 +5,42 @@ GLboolean eglewGetExtension (const char* name) const GLubyte* start; const GLubyte* end; -/* TODO */ -/* return _glewSearchExtension(name, start, end); */ - return GL_FALSE; + start = (const GLubyte*) eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS); + if (0 == start) return GL_FALSE; + end = start + _glewStrLen(start); + return _glewSearchExtension(name, start, end); } GLenum eglewInit () { - int major, minor; + GLuint dot; + GLint major, minor; + const GLubyte* version; const GLubyte* extStart; const GLubyte* extEnd; - /* initialize flags */ - EGLEW_VERSION_1_0 = GL_TRUE; - EGLEW_VERSION_1_1 = GL_TRUE; - EGLEW_VERSION_1_2 = GL_TRUE; - EGLEW_VERSION_1_3 = GL_TRUE; - EGLEW_VERSION_1_4 = GL_TRUE; - EGLEW_VERSION_1_5 = GL_TRUE; + /* query EGK version */ + major = 0; + minor = 0; + version = (const GLubyte*) eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_VERSION); + dot = _glewStrCLen(version, '.'); + if (dot != 0) + { + major = version[dot-1]-'0'; + minor = version[dot+1]-'0'; + } - /* query EGL version */ + EGLEW_VERSION_1_5 = ( major > 1 ) || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_4 = EGLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_3 = EGLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_2 = EGLEW_VERSION_1_3 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_1 = EGLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + EGLEW_VERSION_1_0 = EGLEW_VERSION_1_1 == GL_TRUE || ( major == 1 && minor >= 0 ) ? GL_TRUE : GL_FALSE; /* query EGL extension string */ + extStart = (const GLubyte*) eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_EXTENSIONS); + if (extStart == 0) + extStart = (const GLubyte *)""; + extEnd = extStart + _glewStrLen(extStart); /* initialize extensions */ diff --git a/auto/src/glew_str_glx.c b/auto/src/glew_str_glx.c index af4f8c6..893d741 100644 --- a/auto/src/glew_str_glx.c +++ b/auto/src/glew_str_glx.c @@ -4,7 +4,7 @@ return ret; } -#elif !defined(GLEW_OSMESA) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) +#elif !defined(GLEW_OSMESA) && !defined(GLEW_EGL) && !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX) GLboolean glxewIsSupported (const char* name) { diff --git a/auto/src/glewinfo_glx.c b/auto/src/glewinfo_glx.c index ead3051..e60b549 100644 --- a/auto/src/glewinfo_glx.c +++ b/auto/src/glewinfo_glx.c @@ -1,6 +1,6 @@ } -#elif !defined(GLEW_OSMESA) /* _UNIX */ +#elif !defined(GLEW_EGL) && !defined(GLEW_OSMESA) /* _UNIX */ static void glxewInfo () { diff --git a/auto/src/glewinfo_head.c b/auto/src/glewinfo_head.c index 6391a72..02089f6 100644 --- a/auto/src/glewinfo_head.c +++ b/auto/src/glewinfo_head.c @@ -3,7 +3,7 @@ #include #include #if defined(GLEW_EGL) -#include +#include #elif defined(GLEW_OSMESA) #define GLAPI extern #include