I had a look on osgAnimation and osgCharacter and it seems like skeletal 
animation is something similar to what I like to do.

Now I'm trying to send uniform arrays to the shader. In the end I like to send 
the transform matrices to the shader, but even with uniform float array it 
doesnt seem to work. I've tried to use setElement() and setArray() but nothing 
work.

This is my setElement() code, trying to change the color of the object.


Code:

        osg::Uniform* rgbUniform = new 
osg::Uniform(osg::Uniform::FLOAT,"rgb",3);

        float r = 0.5; float g = 0.7; float b = 0.8;

        rgbUniform->setElement(0,r);
        rgbUniform->setElement(1,g);
        rgbUniform->setElement(2,b);

        stateset->addUniform(rgbUniform);




The fragment shader


Code:

uniform float rgb[3];

void main( void )
{
        gl_FragColor = vec4(rgb[0],rgb[1],rgb[2],1.0);
}




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





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

Reply via email to