OpenGL: Default input variable 'gl_VertexID' missing from vertex shader?



  • Hey

    I have a Qt 5.7 setup where I am using OpenGL 3.0 (no profile) and GLSL 1.3 on Ubuntu 16.04. I am using modern OpenGL in Qt and am using QQuickFramebufferObject as explained here.

    My graphics pipeline is working nicely and I've written a few shaders which are running fine.

    I am now in a situation where I need to write a vertex shader that uses the default vertex shader variable gl_VertexID. For some reason, this does not seems to be available in Qt and the shader fails at runtime?

    According to section 2.20, paragraph 'Shader Inputs' of The OpenGL® Graphics System and section 7.1 of The OpenGL® Shading Language the shader variable should be available if:

    The value of gl VertexID is de-fined if and only if:
    • the vertex comes from a vertex array command that specifies a complete primitive (DrawArrays, MultiDrawArrays, DrawElements, MultiDrawElements, or DrawRangeElements)
    • all enabled vertex arrays have non-zero buffer object bindings, and
    • the vertex does not come from a display list, even if the display list was compiled using one of the vertex array commands described above with data sourced from buffer objects.

    My program full-fill these requirements yet I am not allowed to use the variable.

    Does anybody have any idea if I need some special setting to use this in Qt?



  • After bumping up to GL3.3 and GLSL3.3, I am able to use gl_VertexID without any problems. I cannot say for sure what was wrong when I initially wrote this post


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.