[osg-users] EXTERNAL: Re: Array of structs
Rowley, Marlin R
marlin.r.rowley at lmco.com
Wed Apr 18 07:40:56 PDT 2018
Thanks for this. I’ll do more R&D and let you know what I come up with.
----------------------------------------
Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg at 01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.rowley at lmco.com<mailto:marlin.r.rowley at lmco.com>
From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: Wednesday, April 18, 2018 9:39 AM
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Subject: EXTERNAL: Re: [osg-users] Array of structs
Hi Marln,
On 18 April 2018 at 15:31, Rowley, Marlin R <marlin.r.rowley at lmco.com<mailto:marlin.r.rowley at lmco.com>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180418/ca862e5b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 3114 bytes
Desc: image001.jpg
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180418/ca862e5b/attachment.jpg>
More information about the osg-users
mailing list