<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Robert, </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">good guess! I've enabled the aliasing and my shaders works now with osg default build!</div><div class="gmail_default" style="font-family:tahoma,sans-serif">With this configuration there is still a side effect though: something is wrong with alpha settings for HUD cameras.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">See attached screenshot that shows the issue: it's a modified osgsimplegl3 example with stats handler enabled, but I have alpha issues with other HUDs as well.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">I've counter checked in my examples that the 2 aliasing/uniform calls are the culprit: if I comment them out the shaders don't work anymore but the stats are displayed correctly. </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Riccardo</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 5, 2018 at 5:24 PM Robert Osfield <<a href="mailto:robert.osfield@gmail.com">robert.osfield@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Riccardo,<br>
<br>
On Wed, 5 Sep 2018 at 15:56, Riccardo Corsi <<a href="mailto:riccardo.corsi@kairos3d.it" target="_blank">riccardo.corsi@kairos3d.it</a>> wrote:<br>
> I've rebuilt osg as suggested by Robert and still getting no GL errors but nothing shows up.<br>
> To sum it up, running a test app which only uses libA (which addresses only GL3 functions and shaders version 150)<br>
> under windows:<br>
> - if I link my code to OSG built with  GLCORE profile everything works<br>
> - if I link the same code to OSG build with defaults, nothing shows up<br>
><br>
> As further check, I tried the same with osgsimplegl3 example which works in both OSG builds.<br>
> Any idea on what could be the culprit of my code not working in the same way?<br>
<br>
My best guess is that the GLCORE build of the OSG is setting up the<br>
osg::State vertex and uniform aliasing that you shaders are relying<br>
upon, but in the default build of the OSG these are set by default so<br>
you have to manually set them.<br>
<br>
The osgsimplegl3 example illustrates and explains this:<br>
<br>
    // for non GL3/GL4 and non GLES2 platforms we need enable the osg_<br>
uniforms that the shaders will use,<br>
    // you don't need thse two lines on GL3/GL4 and GLES2 specific<br>
builds as these will be enable by default.<br>
    gc->getState()->setUseModelViewAndProjectionUniforms(true);<br>
    gc->getState()->setUseVertexAttributeAliasing(true);<br>
<br>
These two settings are done by default for GLCORE build, but are off<br>
by default so have to be set explicitly for non GLCORE builds.<br>
<br>
The osgvertexattributes and osgtessellationshaders examples have a<br>
more general purpose approach:<br>
<br>
    osgViewer::Viewer::Windows windows;<br>
    viewer.getWindows(windows);<br>
    for(osgViewer::Viewer::Windows::iterator itr = windows.begin();<br>
        itr != windows.end();<br>
        ++itr)<br>
    {<br>
        osg::State *s=(*itr)->getState();<br>
        s->setUseModelViewAndProjectionUniforms(true);<br>
        s->setUseVertexAttributeAliasing(true);<br>
    }<br>
<br>
Probably the most general way to wrap this up would be to have a<br>
custom RealizeOperation do this, the osgvolume example has an example<br>
of this, although not for the State::setUse*Aliasing(true);<br>
<br>
Hope this helps,<br>
Robert.<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div></div>