Intoduced a new setGLExtensions template method to do a copy of void* pointer to
local function pointer to avoid compiler warnings related to case void*. Moved various OSG classes across to using setGLExtensions instead of getGLExtensions, and changed them to use typedef declarations in the headers rather than casts in the .cpp. Updated wrappers
This commit is contained in:
@@ -68,6 +68,40 @@ inline void* getGLExtensionFuncPtr(const char *funcName,const char *fallbackFunc
|
||||
return getGLExtensionFuncPtr(fallbackFuncName);
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
bool setGLExtensionFuncPtr(T& t, const char* str1)
|
||||
{
|
||||
void* data = osg::getGLExtensionFuncPtr(str1);
|
||||
if (data)
|
||||
{
|
||||
memcpy(&t, &data, sizeof(T));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2)
|
||||
{
|
||||
void* data = osg::getGLExtensionFuncPtr(str1,str2);
|
||||
if (data)
|
||||
{
|
||||
memcpy(&t, &data, sizeof(T));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Return true if OpenGL "extension" is supported.
|
||||
* Note: Must only be called within a valid OpenGL context,
|
||||
* undefined behavior may occur otherwise.
|
||||
|
||||
Reference in New Issue
Block a user