[osg-users] Glsl structs and osg::Uniform. How?

Robert Osfield robert.osfield at gmail.com
Thu Jan 26 06:01:36 PST 2017


Hi Johny,

For each of the members of the struct you have a separate osg::Uniform.

  stateset->addUniform(new osg::Uniform("things[0].color",color));
  stateset->addUniform(new osg::Uniform("things[0].distance",distance));

Robert.

On 26 January 2017 at 12:05, Johny Canes <catchaller at gmail.com> wrote:
> Oi everyone,
>
> The shader:
>
> Code:
> struct Thing {
> vec3 color;
> float distance;
> }
> uniform Thing things[ 2 ];
>
>
>
>
> I've done a lot of googling for this problem but found no way to programatically approach this...
>
> So my question is, how would I set this 'array uniform' from my c++ code using osg::Uniform?
>
> Your answers are appreciated!
>
> Cheers,
> Johny
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70054#70054
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list