Khronos Public Bugzilla
Bug 795 - gl_VertexID poorly specified.
gl_VertexID poorly specified.
Status: NEW
Product: OpenGL
Classification: Unclassified
Component: API Specification
All All
: P3 major
: ---
Assigned To: Jon Leech
Depends on:
  Show dependency treegraph
Reported: 2013-02-11 22:25 PST by Alfonse
Modified: 2013-02-11 22:25 PST (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Alfonse 2013-02-11 22:25:17 PST
The exact behavior of gl_VertexID is not clearly specified by the modern versions of the specifications. It has to do with how the glDraw* functions are specified.

Before GL 3.1 came along, all of the glDraw* functions were specified in terms of glBegin/glEnd and glArrayElement. In those specifications, gl_VertexID is defined as:

> gl_VertexID holds the integer index i explicitly
> passed to ArrayElement to specify the vertex, or
> implicitly passed by DrawArrays or one of the other
> drawing commands defined in section 2.8.1. 

Where 2.8.1 points to all of the glDraw* functions.

That's all well and good. But then core 3.1 came along. Once glBegin/glEnd were removed from the specification, the glDraw* functions couldn't be defined in terms of them. So various language was used to describe them. However, the section for gl_VertexID's definition was never updated. All it says is:

> gl_VertexID holds the integer index i implicitly passed
> by DrawArrays or one of the other drawing commands defined
> in section 2.8.2.

The problem is that there *is no* "i implicitly passed" anywhere. The specification is no longer written in terms of such an "i".

This language persists all the way through 4.3, and even into OpenGL ES 3.0.

The spec language should be cleaned up to make it clear exactly what value gl_VertexID is supposed to get, even in the core specification/ES 3.0.