Paul Martz wrote:
In an ideal world, vertex attributes would work more like uniforms. You'd specify a shader variable name along with your array, and OSG would determine the slot number to use in the call to OpenGL.

For whatever reason, it wasn't implemented that way, and instead you need to specify the slot number yourself. To complicate things, apparently OSG has reserved certain slot numbers for itself in order to support the old GL1/2 special case vertex attributes (like setVertexArray, setNormalArray, setColorArray, etc).

Digging through the code to divine exactly how you should deal with this at the application level is somewhat difficult. A good place to start would be grepping the source for the GL calls related to vertex attributes.


I don't know if this is still true or not, but the NVIDIA drivers used to "alias" the generic vertex attributes with the traditional fixed-function attributes, so, for example, if you used normals in your geometry, you couldn't use generic attribute 2 (it was occupied by the normals).

The attributes mapped up like this (from the GL_ARB_vertex_program specification):

0      vertex position              glVertex
1      vertex weights 0-3           glWeightARB, VertexWeightEXT
2      normal                       glNormal
3      primary color                glColor
4      secondary color              glSecondaryColorEXT
5      fog coordinate               glFogCoordEXT
6      -                            -
7      -                            -
8      texture coordinate set 0     MultiTexCoord(TEXTURE0, ...)
8+n    texture coordinate set n     MultiTexCoord(TEXTURE0+n, ...)


I expect this restriction has gone away with the G80-class (i.e.: OpenGL 3 capable) hardware and higher, but I haven't checked to be sure.

--"J"
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to