What are the Attribute locations for fixed function pipeline in OpenGL 4.0++ core profile?

Outside of NVIDIA drivers, this does not work (reliably). Compliant drivers will only alias glVertexPointer (...) to attribute slot 0. NV in their infinite wisdom devised a standard non-standard scheme many years ago where they aliased all of the fixed-function pointers to certain attribute locations, but I do not know if new NV drivers support this (I honestly have never cared enough to try, it is such a bad practice). You might still be able to find NV’s documentation for their alias mappings, but you are not benefiting anyone by taking advantage of their non-standard behavior.

While other drivers may also alias the fixed-function pointers to generic vertex attribute locations, no documentation exists for their mappings. Unlike NV, I would not trust that the mapping would not change between driver versions, hardware or platform. In fact, even using NV drivers you should not take advantage of this – it was intended to promote legacy support and not as a feature used for new software.

The bottom line is, use generic vertex attributes instead or use a compatibility profile and a version of GLSL that still supports the pre-declared variables that are specifically designed for getting fixed-function vertex data (e.g. gl_Color, gl_Normal, gl_MultiTexCoord0...7, …). But do not mix-and-match both the way you are describing.

Also take some time to review glGetPointerv (...). If you want to get information about the fixed-function pointers outside of GLSL, this is the proper way to do it. Do not rely on vertex attribute aliasing, because the concept of attribute locations is fundamentally a programmable pipeline feature. It did not even exist in unextended OpenGL prior to 2.0 (it was introduced with the ARB Vertex Program assembly language and promoted into core with GLSL).


Update:

While I still strongly advise against using this information, I was able to find exactly what you wanted:

Release Notes for NVIDIA OpenGL Shading Language SupportNovember 9, 2006 – pp. 7-8

Vertex Attribute Aliasing

GLSL attempts to eliminate aliasing of vertex attributes but this is integral to NVIDIA’s hardware approach and necessary for maintaining compatibility with existing OpenGL applications that NVIDIA customers rely on.

NVIDIA’s GLSL implementation therefore does not allow built-in vertex attributes to collide with a generic vertex attributes that is assigned to a particular vertex attribute index with glBindAttribLocation. For example, you should not use gl_Normal (a built-in vertex attribute) and also use glBindAttribLocation to bind a generic vertex attribute named “whatever” to vertex attribute index 2 because gl_Normal aliases to index 2.

  Table excerpt

In case you were wondering, this is also outlined in Table X.1 of the ARB Vertex Program extension specification. The only reason I mentioned NV specifically is because they chose to re-use the aliasing in GLSL whereas compliant implementations from other vendors will only honor the first alias (glVertexPointer (...) to 0) in GLSL.

Leave a Comment