[osg-users] GLES link error for unidentified Program

Robert Osfield robert.osfield at gmail.com
Thu Jan 25 10:02:43 PST 2018


Hi Alessandro,

OK, this shader is a default provided to at least give something to
render.  osg::DisplaySettings::ShaderHint is what controls the
addition of this fallback, in a GLES build it defaults to GLES2 or
GLES3, you can override this and switch it off via:

 osg::DisplaySettings::instance()->setShaderHint(osg::DisplaySettings::SHADER_NONE);

The fallback shaders can be found at OpenSceneGraph/src/osg/StateSet.cpp.

Robert.


On 25 January 2018 at 16:19, Alessandro Terenzi <a.terenzi at gmail.com> wrote:
> Hi Robert,
> and thanks again for your help and suggestions. I'm aware of the remapping done by OSG under the hood, indeed I had no issues with this when targeting GLES 2 with version 3.4.0.
>
> I investigated my issue further and found out that a osg::Program is added to the scene graph by the StateSet::setGlobalDefaults() method which does something like this:
>
>
> Code:
> osg::DisplaySettings::ShaderHint shaderHint = osg::DisplaySettings::instance()->getShaderHint();
>     if (shaderHint==osg::DisplaySettings::SHADER_GL3 || shaderHint==osg::DisplaySettings::SHADER_GLES3)
>     {
>         OSG_INFO<<"   StateSet::setGlobalDefaults() Setting up GL3 compatible shaders"<<std::endl;
>
>         osg::ref_ptr<osg::Program> program = new osg::Program;
>         program->addShader(new osg::Shader(osg::Shader::VERTEX, gl3_VertexShader));
>         program->addShader(new osg::Shader(osg::Shader::FRAGMENT, gl3_FragmentShader));
>         setAttributeAndModes(program.get());
>         setTextureAttribute(0, createDefaultTexture());
>         addUniform(new osg::Uniform("baseTexture", 0));
>     }
>
>
>
> this automatically added program is the one that fails while linking.
>
> Now I'm trying to understand why it fails, but my question is: why is this program added? Is it supposed to provide a 'default' program in case there's nothing else in the scene graph? Can I avoid it to be added?
>
> I'm also trying to understand where StateSet::setGlobalDefaults() is called in the first place...
>
> Cheers,
> Alessandro
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72862#72862
>
>
>
>
>
> _______________________________________________
> 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