[osg-users] bug in primitiveset.cpp?

Robert Osfield robert.osfield at gmail.com
Mon Sep 7 11:39:15 PDT 2015


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 <julienvalentin51 at gmail.com>
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
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150907/7a806f9c/attachment-0003.htm>


More information about the osg-users mailing list