Added checked from the ARG version of glDraw*Instanced().
This commit is contained in:
parent
8418e3cb40
commit
3b192f5119
@ -78,6 +78,22 @@ inline void* getGLExtensionFuncPtr(const char *funcName,const char *fallbackFunc
|
|||||||
return getGLExtensionFuncPtr(fallbackFuncName);
|
return getGLExtensionFuncPtr(fallbackFuncName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return the address of the specified OpenGL function. If not found then
|
||||||
|
* check a second function name, if this fails then return NULL as function is
|
||||||
|
* not supported by OpenGL library. This is used for checking something
|
||||||
|
* like glActiveTexture (which is in OGL1.3) or glActiveTextureARB.
|
||||||
|
*/
|
||||||
|
inline void* getGLExtensionFuncPtr(const char *funcName1, const char *funcName2, const char *funcName3)
|
||||||
|
{
|
||||||
|
void* ptr = getGLExtensionFuncPtr(funcName1);
|
||||||
|
if (ptr) return ptr;
|
||||||
|
|
||||||
|
ptr = getGLExtensionFuncPtr(funcName2);
|
||||||
|
if (ptr) return ptr;
|
||||||
|
|
||||||
|
return getGLExtensionFuncPtr(funcName3);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T, typename R>
|
template<typename T, typename R>
|
||||||
T convertPointerType(R src)
|
T convertPointerType(R src)
|
||||||
{
|
{
|
||||||
@ -118,6 +134,22 @@ bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
bool setGLExtensionFuncPtr(T& t, const char* str1, const char* str2, const char* str3)
|
||||||
|
{
|
||||||
|
void* data = osg::getGLExtensionFuncPtr(str1,str2,str3);
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
memcpy(&t, &data, sizeof(T));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Return true if OpenGL "extension" is supported.
|
/** Return true if OpenGL "extension" is supported.
|
||||||
* Note: Must only be called within a valid OpenGL context,
|
* Note: Must only be called within a valid OpenGL context,
|
||||||
|
@ -756,8 +756,8 @@ void State::initializeExtensionProcs()
|
|||||||
setGLExtensionFuncPtr(_glDisableVertexAttribArray, "glDisableVertexAttribArray","glDisableVertexAttribArrayARB");
|
setGLExtensionFuncPtr(_glDisableVertexAttribArray, "glDisableVertexAttribArray","glDisableVertexAttribArrayARB");
|
||||||
setGLExtensionFuncPtr(_glBindBuffer, "glBindBuffer","glBindBufferARB");
|
setGLExtensionFuncPtr(_glBindBuffer, "glBindBuffer","glBindBufferARB");
|
||||||
|
|
||||||
setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedEXT");
|
setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedARB","glDrawArraysInstancedEXT");
|
||||||
setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedEXT");
|
setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedARB","glDrawElementsInstancedEXT");
|
||||||
|
|
||||||
if ( osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_shader") )
|
if ( osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_shader") )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user