Thanks Jason,

So, since I can't combine programs (I didn't necessarily mean multiple shaders, 
I just meant multiple programs), I decided to take this line of code:

program->addBindAttribLocation("indices", 6);

and move it to where I assemble my shader program and attach it to the node's 
stateset.  This way my nodeVisitor can still set my generic vertex array in 
position 6 and my osg::Program's shader can access those index values by 
including the following line in the frag shader:

in float indices;

I looked at the osg file that I wrote to disk and verified that my stateset's 
program contained this line:

AttribBindingLocation indices 6

However, when I use indices in my shader, the resulting value is always equal 
to 0.0, even though my VertexAttributeArray values range from 0.0 to 124.0.  I 
don't want to impose on you too much since you've already helped me out a great 
deal, but I'm going to go ahead and attach an osg file that demonstrates this 
behavior.  The file is a simple human shape with 125 primitives.  I created a 
generic vertex array with index values sequential from 0-124.  I also attached 
a simple shader that paints everything green if the indices = 0 and red 
otherwise.  As you can see by opening this file in osgviewer, all values are 
green.  If you have time to look at it that would be fantastic but I completely 
understand if you don't.  Thanks again,

-Ethan

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



Attachment: human.osg
Description: Binary data

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to