Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. OpenGL: Default input variable 'gl_VertexID' missing from vertex shader?
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abp_dk
    wrote on 16 Mar 2017, 12:59 last edited by abp_dk
    #1

    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?

    A 1 Reply Last reply 29 Mar 2017, 12:18
    0
    • A abp_dk
      16 Mar 2017, 12:59

      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?

      A Offline
      A Offline
      abp_dk
      wrote on 29 Mar 2017, 12:18 last edited by
      #2

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved