Hi Chris,

I would recommend using the osg_ModelViewMatrix etc. as these are fully
supported once you enable them and is far simpler than workarounds like you
are trying.  All you need to do is enable the aliasing to get the OSG to
generate the uniforms.  The osgsimplegl3 example illustrates how :


    // for non GL3/GL4 and non GLES2 platforms we need enable the osg_
uniforms that the shaders will use,
    // you don't need thse two lines on GL3/GL4 and GLES2 specific builds
as these will be enable by default.
    gc->getState()->setUseModelViewAndProjectionUniforms(true);
    gc->getState()->setUseVertexAttributeAliasing(true);

Could you explain what the problem was when trying to the OSG's built in
aliasing?

Robert.

On 9 August 2017 at 09:35, Chris Kuliukas <ch...@kuliukas.com> wrote:

> Hi,
>
> What is the proper way to set the view/projection matrix to a uniform
> yourself? I've found that trying to deal with the osg_ built-in uniforms
> which do all sorts of renaming etc is unreliable and would like to be able
> to just set everything myself manually.
>
> At the moment I'm setting the view / projection matrix uniforms within the
> camera's initialdrawcallback, but I'm not sure if this is the right way to
> do it that will ensure the uniform value will only be used within that
> camera and not within other cameras (since it needs to work across multiple
> screens and render stages).
>
> Is there some code within OSG that ensures that a uniform assigned to a
> camera will only apply to the graphics context for the thread that set it?
>
>
> Thank you!
>
> Cheers,
> Chris
>
> ------------------------
> http://www.hrwallingford.com/facilities/ship-simulation-centre (
> http://www.hrwallingford.com/facilities/ship-simulation-centre)
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=71391#71391
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to