[osg-users] Question about array binding
Werner Modenbach
Werner.Modenbach at modenbach-ac.de
Tue Mar 9 04:55:02 PST 2021
Hi all,
I was hunting a long time for some strange effect. I discovered the reason but have some understanding issues.
Why is Code 1 not working but code 2? I would prefer Code 1 because of less data.
Code 1) (my original code is not working)
osg::ref_ptr<osg::IntArray> osgVertexFlagsVector;
osgVertexFlagsVector = new osg::IntArray(1);
osgVertexFlagsVector->setBinding(osg::Array::BIND_OVERALL);
_geometry->setVertexAttribArray(VERTEX_FLAGS_ATR_UNIT, osgVertexFlagsVector.get(), osg::Array::BIND_OVERALL);
(*osgVertexFlagsVector)[0] = VERTEX_FLAG_VISIBLE;
Code 2) (this code is working)
osg::ref_ptr<osg::IntArray> osgVertexFlagsVector;
osgVertexFlagsVector = new osg::IntArray(numVertices);
osgVertexFlagsVector->setBinding(osg::Array::BIND_PER_VERTEX);
_geometry->setVertexAttribArray(VERTEX_FLAGS_ATR_UNIT, osgVertexFlagsVector.get(), osg::Array::BIND_PER_VERTEX);
for (auto i=0; i<numVertices; i++)
(*osgVertexFlagsVector)[i] = VERTEX_FLAG_VISIBLE;
Many thanks in advance
- Werner -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20210309/c89a4274/attachment.html>
More information about the osg-users
mailing list