Hi Robert, Ok, thanks for the answer. I was thinking about what kind of magic was osg doing in the background to achieve this bind-per-primitive thing with vertex arrays, but now I got your answer.
Trying to bind data per vertex requires repeating each shared vertex for each triangle, which means I need to modify the geometry. I think I will look at instancing. BTW, is it safe to use gl_PrimitiveID ? Thanks, -deniz robertosfield wrote: > HI Deniz, > > Modern OpenGL doesn't support per primitive bindings, the OSG used to > simulate bind per primitive for backwards compatibility with old OpenGL 1.x > era usage of glBegin/glEnd that enabled bind per primitive but with OSG-3.2 I > have removed this feature from osg::Geometry. There is support for > restructuring old style osg::Geometry that still use BIND_PER_PRIMITIVE to > prevent old databases from not being loaded, To fix these problem > osg::Geometry the OSG has to duplicate vertex/normals/colours. > > > The upshot is that you don't want to get distracted by BIND_PER_PRIMITIVE, > it's not supported by modern OpenGL and no longer supported by the OSG. > > > Now the doesn't particular help one who want to apply a unique id per > triangle. The way I'd tackle it would be to put the data per vertex, or look > at instancing. > > > > > Robert. > > > > > > On 9 November 2013 17:48, deniz diktas < ()> wrote: > > > Hi, > > > > I want to assign a generic vertex attribute for each primitive (triangle). > > I have written a visitor for this and used setVertexAttribArray() and > > setVertexAttribBinding() to add the id-attribute to the geometry > > (BIND_PER_PRIMITIVE). I have also added the attribute in the shader and > > introduced it to the shader program using addBindAttribLocation(), but > > have not been able to get the desired attribute ID for each triangle. I > > could do this with a plain opengl code but cannot do it here. I am clearly > > missing something but I cannot see it clearly. any ideas? > > > > > > thanks, > > deniz > > > > ------------------ > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=57156#57156 > > (http://forum.openscenegraph.org/viewtopic.php?p=57156#57156) > > > > > > > > > > > > _______________________________________________ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > ------------------ > Post generated by Mail2Forum ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57160#57160 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

