Re: [osg-users] Question about array binding
On Wed, 10 Mar 2021 at 15:35, Werner Modenbach < werner.modenb...@modenbach-ac.de> wrote: > Hi Robert, > > I had a look at the code in osg::Geometry. The lines in question are: > > if ( handleVertexAttributes ){ > > for(unsigned int index = 0; index < _vertexAttribList.size(); ++index) > > { > > const Array* array = _vertexAttribList[index].get(); > > if (array && array->getBinding()==osg::Array::BIND_PER_VERTEX) > > { > > vas->setVertexAttribArray(state, index, array); > > } > > } > > } > > Do you remember, why the condition > getBinding() == BIND_PER_VERTEX > is there? > *But(!) *the same condition is at _normalArray, _colorArray etc. and they > are handled correct with BIND_OVERALL. > > I don't understand what is really done there. Sorry. > I'm pretty rusty with the code in question, but my guess is that this constraint could be rather old, dating back to when vertex attribute support was first added and mirrored the hardwiring of texture coordinates to be per vertex. I can't see any reason why this per vertex restriction would be needed now. Try the check against BIND_PER_VERTEX and see what happens. Which version of the OSG are you using? Cheers, Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Question about array binding
Hi Robert, I had a look at the code in osg::Geometry. The lines in question are: if(handleVertexAttributes) { for(unsignedintindex=0;index<_vertexAttribList.size();++index) { constArray*array=_vertexAttribList[index].get(); if(array&>getBinding()==osg::Array::BIND_PER_VERTEX) { vas->setVertexAttribArray(state,index,array); } } } Do you remember, why the condition getBinding() == BIND_PER_VERTEX is there? _But(!) _the same condition is at _normalArray, _colorArray etc. and they are handled correct with BIND_OVERALL. I don't understand what is really done there. Sorry. - Werner - Am 09.03.2021 um 21:27 schrieb Robert Osfield: > HI Werner, > > I can't think of think of reason that would cause a problem. It's quite a > while since I look at the associated code so it might be simply that I've > forgotten constraints. Have > a look at the osg::Geometry::drawImplementation() to see if there is a > constraint on vertex attributes needing to be BIND_PER_VERTEX. > > If you were using the VSG that I'd suggest running with Vulkan debug and API > layer as it's great for picking up errors. Are there any OpenGL errors being > produced? > > Robert. > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Question about array binding
HI Werner, I can't think of think of reason that would cause a problem. It's quite a while since I look at the associated code so it might be simply that I've forgotten constraints. Have a look at the osg::Geometry::drawImplementation() to see if there is a constraint on vertex attributes needing to be BIND_PER_VERTEX. If you were using the VSG that I'd suggest running with Vulkan debug and API layer as it's great for picking up errors. Are there any OpenGL errors being produced? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Question about array binding
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 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 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___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org