[osg-users] bug in primitiveset.cpp?

Julien Valentin julienvalentin51 at gmail.com
Mon Sep 7 10:45:40 PDT 2015


Hello all
I notice strange code at l231 of PrimitiveSet.cpp:
 
Code:
if (useVertexBufferObjects)
    {
        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
        state.bindElementBufferObject(ebo);
        if (ebo)
        {
            if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
            else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
        }
        else
        {
            if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, &front(), _numInstances);
            else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, &front());
        }
    }
    else



Does state.bindElementBufferObject(ebo); shouldn't be included in the if(ebo) test in case theres no index for the geometry?

Thank you!

Cheers,
Julien[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65052#65052








More information about the osg-users mailing list