Hi Ethan,
Thanks for bearing with me Robert, I do realize that there has been much 
discussion over this topic (I have spent hours trying to understand it all but 
OSG is the only exposure to OpenGL that I've ever had so trying to understand 
it all is tricky for me).

You mention using the osg_deprecated to tide me over, but I'm wondering what is 
the more appropriate long-term solution.  To be clear, I don't need to support 
any existing geometry that contains BIND_PER_PRIMITIVE (i.e. I don't need to 
use fixDeprecatedData().  What I do need to do is to be able to create new 
osgGeometry objects with osg3.2 and future versions of osg that allow me to 
have the end-effect of coloring each primitive individually.  Now, if I am 
understanding correctly, what I will have to do when creating new geometry is 
to only put a single primitive in each primitiveset and use 
BIND_PER_PRIMITIVE_SET.  My understanding is that BIND_PER_PRIMITIVE_SET is 
supported in OpenGL and that this will not be deprecated any time soon.  Do I 
have this more or less correct?
Bind per primitive is supported, and I guess that it won't be deprecated any time soon. If you don't want to split up your geometry into many tiny sets you can also try some other approach, which might be more efficient. A good approach might be to clone the vertex attributes (like color, normals) and the vertices if shared when creating your primitives: So you will end up with something like this, supposed your primitives are triangles.
VertexBuffer: V1,V2,V3,V4,V5,V6,.... (where the first triangle is V1..V3)
ColorBuffer C1,C1,C1,C2,C2,C2,C3,C3,C3 (where C1 is the first triangle's color)

If your triangles are in a regular grid you could also use instancing and assign the color with an uniform buffer object. Depending on how dynamic your color is, you could also pack it to a texture and point sample the primitive's color in the vertex shader.

cheers
Sebastian




------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=57887#57887





_______________________________________________
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

Reply via email to