Hi Julien, I've just looked at the State::bindElementBufferObject(..) implementation and it looks like it attempts to access the ebo even if the ptr is 0 which will cause a crash.
I'm guess this probably doesn't happen if the osg::Geometry is set up correctly as the EBO should be created, as if useVertexBufferObjects is true then the ebo "should" be non zero. This doesn't mean that either the State::bindElementBufferObject(..) or the DrawElements could should not be fixed though. Are you seeing a crash? Robert. Robert. On 7 September 2015 at 18:45, Julien Valentin <[email protected]> wrote: > 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 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

