From 2983bbe6c31b311997b5a05c397691e8d5ee3ff6 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 11 Nov 2009 09:15:03 +0000 Subject: [PATCH] Merged runtime fix for Win32 OpenGLES build that avoids usage of wglGetProcAddress. --- src/osg/GLExtensions.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index 0a3b0fb7a..23184545a 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -104,7 +104,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex } if (*startOfWord!=0) extensionSet.insert(std::string(startOfWord)); - #if defined(WIN32) + #if defined(WIN32) && (defined(OSG_GL1_AVAILABLE) || defined(OSG_GL2_AVAILABLE) || defined(OSG_GL3_AVAILABLE)) // add WGL extensions to the list @@ -322,7 +322,15 @@ void* osg::getGLExtensionFuncPtr(const char *funcName) #if defined(WIN32) - return convertPointerType(wglGetProcAddress(funcName)); + #if defined(OSG_GLES2_AVAILABLE) + static HMODULE hmodule = GetModuleHandle("libGLESv2.dll"); + return convertPointerType(GetProcAddress(hmodule, funcName)); + #elif defined(OSG_GLES1_AVAILABLE) + static HMODULE hmodule = GetModuleHandle("libgles_cm.dll"); + return convertPointerType(GetProcAddress(hmodule, funcName)); + #else + return convertPointerType(wglGetProcAddress(funcName)); + #endif #elif defined(__APPLE__) @@ -382,7 +390,7 @@ void* osg::getGLExtensionFuncPtr(const char *funcName) #elif defined (__QNX__) - return dlsym(RTLD_DEFAULT, funcName); + return dlsym(RTLD_DEFAULT, funcName); #else // all other unixes