Skip to content
Snippets Groups Projects
Commit a74dd588 authored by Martin Schultz's avatar Martin Schultz
Browse files

fixed segfault, when OpenGL Version less than 3.3 is used because

glVertexAttribDivisor is a nullpointer. Use ARB extension call instead
parent 831b973c
No related branches found
No related tags found
1 merge request!88Feature picking shader compatibility
......@@ -467,9 +467,16 @@ void VertexDeclaration::activateShaderPipeline(GLSL::Program* _prog) const
glVertexAttribPointer(loc, pElem->numElements_, pElem->type_, normalizeElem, vertexStride, pElem->pointer_);
if (supportsInstancedArrays())
{
if( openGLVersion(3,3) )
{
glVertexAttribDivisor(loc, pElem->divisor_);
}
else
{
glVertexAttribDivisorARB(loc, pElem->divisor_);
}
}
else if (pElem->divisor_)
std::cerr << "error: VertexDeclaration::activateShaderPipeline - instanced arrays not supported by gpu!" << std::endl;
......@@ -499,9 +506,16 @@ void VertexDeclaration::deactivateShaderPipeline( GLSL::Program* _prog ) const
glDisableVertexAttribArray(loc);
if (supportsInstancedArrays() && pElem->divisor_)
{
if( openGLVersion(3,3) )
{
glVertexAttribDivisor(loc, 0);
}
else
{
glVertexAttribDivisorARB(loc, 0);
}
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment