Thanks for this. I’ll do more R&D and let you know what I come up with.
---------------------------------------- Marlin Rowley Software Engineer, Staff [cid:[email protected]] Missiles and Fire Control 972-603-1931 (office) 214-926-0622 (mobile) [email protected]<mailto:[email protected]> From: osg-users [mailto:[email protected]] On Behalf Of Robert Osfield Sent: Wednesday, April 18, 2018 9:39 AM To: OpenSceneGraph Users <[email protected]> Subject: EXTERNAL: Re: [osg-users] Array of structs Hi Marln, On 18 April 2018 at 15:31, Rowley, Marlin R <[email protected]<mailto:[email protected]>> wrote: Is there an example of setting values in a uniform struct to pass to the shaders along with the shader code that uses these values? I don't recall if we have an example illustrating setting of uniform struct - I haven't written all the OSG examples or other parts of the OSG code base so can only easily speak off the top of my head of what I've written or have worked closely with, the rest I just look up using grep :-) Although I don't have an example I can point you at, I have used struct in Uniforms before by declaring the struct in the shader source, then in the osg::Uniform setup use a separate osg::Uniform for each uniform i.e. -- GLSL code: struct MyStruct { float a; float b; }; uniform MyStruct mystruct; --- C++ code : stateset->addUniform(new osg::Uniform("mystruct.a", 1.0f)); stateset->addUniform(new osg::Uniform("mystruct.b", 2.5f)); Hope this helps. Robert.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

