[osg-users] GLES link error for unidentified Program

Robert Osfield robert.osfield at gmail.com
Thu Jan 25 01:40:21 PST 2018


Hi Alessandro,

I tested the models under my GL2 build of the OSG and the dump1.osgt
worked fine for me without any errors.  I don't have time to test GLES
right now.

The vertex shader doesn't provide any hint for the precision, it might
be the the GLES drivers GLSL compiler is having an issue with that.

Also when targeting just GLES you always have to use the OSG's version
of gl_ModelViewMatrix, gl_Vertex etc, so you'll need to use
osg_ModelViewMatrix, osg_Vertex etc.  The osg::State class will by
default be remapping these for you with the GLES2+ build so behind the
scenes this is being handled for you.  While you should be aware that
this is happening, I don't think it's related to the issue you are
seeing.  If you want to keep the shaders portable to GL2 then leaving
the gl_ModelViewMatrix in place is fine.

The master version of the OSG now provide support for inject
environmental values via osg::DisplaySettings::setValues(..), and
provides some defaults for these like OSG_GLSL_VERSION and
$OSG_PRECISSION_FLOAT tailored for the build type such as GL/GL3/GLES.
You can see this in action in the text.vert now in OpenSceneGraph-Data
master and OSG master (and recent dev release):

$OSG_GLSL_VERSION
$OSG_PRECISION_FLOAT

$OSG_VARYING_OUT vec2 texCoord;
$OSG_VARYING_OUT vec4 vertexColor;

void main(void)
{
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    texCoord = gl_MultiTexCoord0.xy;
    vertexColor = gl_Color;
}

It might be that it would be appropriate to use these to help with
future shaders to allow you to port between platforms easily.

Robert.

On 24 January 2018 at 16:18, Alessandro Terenzi <a.terenzi at gmail.com> wrote:
> Hi,
> I used to work with OSG 3.4.0 (stable) and now I'm trying version 3.5.10 on iOS (trying both GLES 2 and 3) but now I having the following error when the first frame is drawn:
>
> glLinkProgram 0x1c41cda70"" FAILED
> Program "" infolog:
> ERROR: OpenGL ES requires exactly one vertex and one fragment shader to validly link.
>
> Note that I have only one quad to which I apply a texture, I'm using a single 'vertex' and 'fragment shader' and there's only on 'program' around. The same code works fine with OSG 3.4.0 and even though with version 3.5.10 there is the above error, the texture is nonetheless displayed.
>
> If I use a more verbose notification level I see that my program "BckProgram" is compiled and linked correctly but then another program with empty name is tried to be linked and it is the one for which I'm receiving the above error, but I did not create a second program anywhere... am I missing something?
>
> And here's the verbose log:
>
> View::init()
> cull()
> cull() got SceneView 0x106510300
> ShaderComposer::~ShaderComposer() 0x1c02d7450
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> end cull() 0x1065101f0
> draw() got SceneView 0x106510300
> Renderer::compile()
> State::convertShaderSourceToOsgBuiltIns()
> ++Before Converted source
> varying vec2 texcoord;
> void main(void)
> {
>     texcoord = gl_MultiTexCoord0.xy;
>     gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
> }
>
> ++++++++
> -------- Converted source
> attribute vec4 osg_MultiTexCoord0;
> attribute vec4 osg_Vertex;
> uniform mat4 osg_ModelViewProjectionMatrix;
> varying vec2 texcoord;
> void main(void)
> {
>     texcoord = osg_MultiTexCoord0.xy;
>     gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
> }
>
> ----------------
>
> Compiling A :VERTEX source:
>     1: attribute vec4 osg_MultiTexCoord0;
>     2: attribute vec4 osg_Vertex;
>     3: uniform mat4 osg_ModelViewProjectionMatrix;
>     4: varying vec2 texcoord;
>     5: void main(void)
>     6: {
>     7:     texcoord = osg_MultiTexCoord0.xy;
>     8:     gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
>     9: }
>
> State::convertShaderSourceToOsgBuiltIns()
> ++Before Converted source
> precision mediump float;
> uniform sampler2D texture0;
> varying vec2 texcoord;
> void main(void)
> {
>     gl_FragColor = texture2D( texture0, vec2(texcoord.x, 1.0-texcoord.y));
> }
>
> ++++++++
> -------- Converted source
> precision mediump float;
> uniform sampler2D texture0;
> varying vec2 texcoord;
> void main(void)
> {
>     gl_FragColor = texture2D( texture0, vec2(texcoord.x, 1.0-texcoord.y));
> }
>
> ----------------
>
> Compiling A :FRAGMENT source:
>     1: precision mediump float;
>     2: uniform sampler2D texture0;
>     3: varying vec2 texcoord;
>     4: void main(void)
>     5: {
>     6:     gl_FragColor = texture2D( texture0, vec2(texcoord.x, 1.0-texcoord.y));
>     7: }
>
> Linking osg::Program "BckProgram" id=3 contextID=0
> State's vertex attrib binding 2, osg_Color
> State's vertex attrib binding 12, osg_FogCoord
> State's vertex attrib binding 3, osg_MultiTexCoord0
> State's vertex attrib binding 4, osg_MultiTexCoord1
> State's vertex attrib binding 5, osg_MultiTexCoord2
> State's vertex attrib binding 6, osg_MultiTexCoord3
> State's vertex attrib binding 7, osg_MultiTexCoord4
> State's vertex attrib binding 8, osg_MultiTexCoord5
> State's vertex attrib binding 9, osg_MultiTexCoord6
> State's vertex attrib binding 10, osg_MultiTexCoord7
> State's vertex attrib binding 1, osg_Normal
> State's vertex attrib binding 11, osg_SecondaryColor
> State's vertex attrib binding 0, osg_Vertex
> Program "BckProgram" link succeeded, infolog:
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord7' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord5' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_SecondaryColor' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord1' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord6' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_FogCoord' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_Normal' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_Color' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord4' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord2' to match BindAttributeLocation request.
> WARNING: Could not find vertex shader attribute 'osg_MultiTexCoord3' to match BindAttributeLocation request.
>
>         Uniform "texture0" loc=4 size=1 type=sampler2D
>         Uniform "osg_ModelViewProjectionMatrix" loc=0 size=1 type=mat4
>         Attrib "osg_MultiTexCoord0" loc=3 size=1
>         Attrib "osg_Vertex" loc=0 size=1
>
> Created new 0x1c41294c0 TextureObject, _numOfTextureObjects 1
> Warning: detected OpenGL error 'invalid enumerant' at after stateset.compileGLObjects in GLObjectsVisitor::apply(osg::StateSet& stateset)
> OpenGL extension '' is not supported.
> Adding parent0x1c02327e0
> Adding parent0x1c02327e0
> RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) 0x1063270e0
> Setting up osg::Camera::FRAME_BUFFER
> GLBufferObjectSet::GLBufferObjectSet _profile._size=80
>     Allocating new glBufferData(), _allocatedSize=80
> 2018-01-24 16:58:10.501060+0100 CameraCaptureExample[7697:6519318] deviceOrientationDidChange: 5
> Created new 0x1c41296a0 TextureObject, _numOfTextureObjects 1
> Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)
> Linking osg::Program "" id=4 contextID=0
> State's vertex attrib binding 2, osg_Color
> State's vertex attrib binding 12, osg_FogCoord
> State's vertex attrib binding 3, osg_MultiTexCoord0
> State's vertex attrib binding 4, osg_MultiTexCoord1
> State's vertex attrib binding 5, osg_MultiTexCoord2
> State's vertex attrib binding 6, osg_MultiTexCoord3
> State's vertex attrib binding 7, osg_MultiTexCoord4
> State's vertex attrib binding 8, osg_MultiTexCoord5
> State's vertex attrib binding 9, osg_MultiTexCoord6
> State's vertex attrib binding 10, osg_MultiTexCoord7
> State's vertex attrib binding 1, osg_Normal
> State's vertex attrib binding 11, osg_SecondaryColor
> State's vertex attrib binding 0, osg_Vertex
> glLinkProgram 0x1c41cda70"" FAILED
> Program "" infolog:
> ERROR: OpenGL ES requi2018-01-24 16:58:10.503075+0100 CameraCaptureExample[7697:6519318] ...
> res exactly one vertex and one fragment shader to validly link.
>
> Program "" infolog:
> ERROR: OpenGL ES requires exactly one vertex and one fragment shader to validly link.
>
> cull()
> cull() got SceneView 0x106326740
> ShaderComposer::~ShaderComposer() 0x1c02d74c0
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> Uniform Adding parent
> end cull() 0x1065101f0
> end draw() 0x1065101f0
> draw() 0x1065101f0
> draw() got SceneView 0x106326740
> OpenGL extension '' is not supported.
> Adding parent0x1c02327e0
> Adding parent0x1c02327e0
> RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) 0x106327d30
> Setting up osg::Camera::FRAME_BUFFER
> 2018-01-24 16:58:10.510586+0100 CameraCaptureExample[7697:6519318] ...
> cull()
> cull() got SceneView 0x106510300
> end cull() 0x1065101f0
> end draw() 0x1065101f0
> draw() 0x1065101f0
> draw() got SceneView 0x106510300
> end draw() 0x1065101f0
>
> After this the cull/draw calls repeat without errors.
>
> Thank you!
> Alessandro
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72854#72854
>
>
>
>
>
> _______________________________________________
> 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