[osg-users] Transform matrix as Uniform to shaders

Robert Osfield robert.osfield at gmail.com
Thu Oct 5 03:58:13 PDT 2017


Hi Nikolai,

If you are using a GL2 build of the OSG then you can just use the built-ins
like gl_ModelViewMatrix.  If you are using GL3/GLCoreProfile or GLES2 then
you'll tell the OSG to provide osg_ModelViewMatrix etc. in place of the
gl_ModelViewMaitrx etc.


You can tell the OSG to provide the osg_ variations by setting the
osg::State::setUseModelViewAndProjectionUniforms(true), but if your are
building the OSG using GLES2/GLES3 or GL3/GLCoreProfile then this setting
will be true by default.

Have a look at the osgshaders and osgsimplegl3 examples.

Robert.

On 5 October 2017 at 05:19, Nikolai Christensen <emptyyetfull at gmail.com>
wrote:

> Hi,
>
> I need a matrix for the transform from root scene node to the node where
> the mesh the shaders currently are operating on is in.
>
> Does OSG pass such a matrix automatically to the shaders?
> If yes, is there other uniforms passed and is there a list of them
> somewhere?
>
> Sorry if my question is dumb, I am new to shaders.
>
> Thank you!
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72103#72103
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20171005/1a41f7d9/attachment-0001.html>


More information about the osg-users mailing list