Merged fixes to the osg::GLExtensions function pointer code from Stefan Huber,
and a fix to osg::State's secondary color code from Bob Kuehne. Moved the body of the getGLExtensionFuncPtr() into the header to help out support for Windows mapping of different OpenGL extensions function ptr per dll.
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
#include <mach-o/dyld.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <osg/GL>
|
||||
#include <osg/GLExtensions>
|
||||
@@ -58,27 +51,3 @@ const bool osg::isGLExtensionSupported(const char *extension)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void* osg::getGLExtensionFuncPtr(const char *funcName)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
return wglGetProcAddress(funcName);
|
||||
#elif defined(__DARWIN_OSX__)
|
||||
std::string temp( "_" );
|
||||
NSSymbol symbol;
|
||||
temp += funcName; // Mac OS X prepends an underscore on function names
|
||||
symbol = NSLookupAndBindSymbol( temp.c_str() );
|
||||
return NSAddressOfSymbol( symbol );
|
||||
#else // all other unixes
|
||||
// Note: although we use shl_load() etc. for Plugins on HP-UX, it's
|
||||
// not neccessary here since we only used them because library
|
||||
// intialization was not taking place with dlopen() which renders
|
||||
// Plugins useless on HP-UX.
|
||||
static void *lib = dlopen("libGL.so", RTLD_LAZY);
|
||||
if (lib)
|
||||
return dlsym(lib, funcName);
|
||||
else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -241,7 +241,6 @@ void Geometry::drawImmediateMode(State& state)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static SecondaryColor3ubvProc s_glSecondaryColor3ubv =
|
||||
(SecondaryColor3ubvProc) osg::getGLExtensionFuncPtr("glSecondaryColor3ubv","glSecondaryColor3ubvEXT");
|
||||
static SecondaryColor3fvProc s_glSecondaryColor3fv =
|
||||
|
||||
@@ -469,7 +469,7 @@ void State::setSecondaryColorPointer( GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *ptr )
|
||||
{
|
||||
static SecondaryColorPointerProc s_glSecondaryColorPointer =
|
||||
(SecondaryColorPointerProc) osg::getGLExtensionFuncPtr("glFogCoordPointer","glFogCoordPointerEXT");
|
||||
(SecondaryColorPointerProc) osg::getGLExtensionFuncPtr("glSecondaryColorPointer","glSecondaryColorPointerEXT");
|
||||
|
||||
if (s_glSecondaryColorPointer)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user