All, I was successful in getting a floating point array uniform going for my shader. At Paul's request, here's what I did...
In the shader setup code:
osg::FloatArray* altitude_array;
.
altitude_array = new osg::FloatArray(alt_num);
.
for (int i = 0; i < alt_num; i++)
(*altitude_array)[i] = a floating point value;
.
osg::Uniform* altitudes = new osg::Uniform();
altitudes->setName("altitudes");
altitudes->setType(osg::Uniform::FLOAT);
altitudes->setNumElements(alt_num);
altitudes->setArray(altitude_array);
.
State->addUniform(altitudes);
.
In the update callback:
.
.
// altitude_array entries update per frame...
State->getUniform("altitudes")->setArray(altitude_array);
.
.
Hope this helps...
-Shayne
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Paul Martz
Sent: Tuesday, April 07, 2009 7:35 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] array of floats to a shader?
I haven't used an array Uniform before either. In the past I've used a 1D
float texture. If you get this to work, let us know how it goes.
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jason Daly
Sent: Tuesday, April 07, 2009 12:19 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] array of floats to a shader?
Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC wrote:
> I believe I found something...osg::Uniform::setArray(osg::FloatArray
> *array)? Hopefully this is correct.
>
> I'm assuming there's something to specify the number of elements?
>
You can use setNumElements() and setElement(). I haven't used
setArray() before, but I assume that works as well.
--"J"
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

