Simplified code using GLEXtensions.

This commit is contained in:
Robert Osfield 2021-03-31 15:54:07 +01:00
parent e9ab9ca108
commit 0612b03eab

View File

@ -41,22 +41,15 @@ public:
virtual void drawImplementation(osg::RenderInfo& renderInfo) const virtual void drawImplementation(osg::RenderInfo& renderInfo) const
{ {
const osg::GLExtensions* extensions = renderInfo.getState()->get<osg::GLExtensions>(); const osg::GLExtensions* extensions = renderInfo.getState()->get<osg::GLExtensions>();
if (extensions->isMeshShaderSupported && extensions->glDrawMeshTasksNV)
void* (* my_glXGetProcAddress) (const GLchar *name);
osg::setGLExtensionFuncPtr(my_glXGetProcAddress, "glXGetProcAddress", "glXGetProcAddressARB");
void (GL_APIENTRY * my_glDrawMeshTasksNV) (GLuint first, GLuint count);
osg::convertPointer(my_glDrawMeshTasksNV, my_glXGetProcAddress("glDrawMeshTasksNV"));
if (extensions->isMeshShaderSupported && my_glDrawMeshTasksNV)
{ {
my_glDrawMeshTasksNV(first, count); extensions->glDrawMeshTasksNV(first, count);
} }
else else
{ {
OSG_NOTICE<<"glDrawMeshTasksNV not supported. "<<std::endl; OSG_NOTICE<<"glDrawMeshTasksNV not supported. "<<std::endl;
} }
} }
}; };