[osg-users] GLES link error for unidentified Program

Alessandro Terenzi a.terenzi at gmail.com
Thu Jan 25 08:19:22 PST 2018


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







More information about the osg-users mailing list