Conventional and generic vertex attributes (ARB_VERTEX_PROGRAM)

I’m writing a wrapper for OpenGL and I have to support fixed pipeline and ARB_VERTEX/FRAGMENT_PROGRAM.

The spec for ARB_VERTEX_PROGRAM says that vertex.position and vertex.attrib[0] are equivalent.

In table X.2.1 conventional attribute binding and generic attribute binding pairs are listed. For example, the vertex.color and vertex.attrib[3] are listed as a pair. However, when I use glVertexAttribPointerARB to send my vertex colors (using attribute index 3) to my shaders, vertex.color only returns white (vertex.attrib[3] works fine). If I use glEnable(GL_COLOR_ARRAY) and glColorPointer vertex.color works as expected (and vertex.attrib[3] doesn’t).

Is it possible to use the conventional attribute bindings in vertex shaders and send data using the generic attribute function (glVertexAttribPointer) or is this limited to just vertex.position + vertex.attrib[0]?

  • Esa

From ARB_vertex_program spec:

Implementations may, but do not necessarily, use the same storage for the
current values of generic and certain conventional vertex attributes.
[b]When any generic vertex attribute other than zero is specified, the
current values for the corresponding conventional attribute in Table X.1
become undefined.[/b]  [b]Additionally, when a conventional vertex attribute is
specified, the current values for the corresponding generic vertex
attribute in Table X.1 become undefined.[/b]  For example, setting the current
normal will leave generic vertex attribute 2 undefined, and vice versa.
Attribute   Conventional Attribute       Conventional Attribute Command
---------   ------------------------     ------------------------------
     0      vertex position              Vertex
     1      vertex weights 0-3           WeightARB, VertexWeightEXT
     2      normal                       Normal
     3      primary color                Color
     4      secondary color              SecondaryColorEXT
     5      fog coordinate               FogCoordEXT
     6      -                            -
     7      -                            -
     8      texture coordinate set 0     MultiTexCoord(TEXTURE0, ...)
     9      texture coordinate set 1     MultiTexCoord(TEXTURE1, ...)
    10      texture coordinate set 2     MultiTexCoord(TEXTURE2, ...)
    11      texture coordinate set 3     MultiTexCoord(TEXTURE3, ...)
    12      texture coordinate set 4     MultiTexCoord(TEXTURE4, ...)
    13      texture coordinate set 5     MultiTexCoord(TEXTURE5, ...)
    14      texture coordinate set 6     MultiTexCoord(TEXTURE6, ...)
    15      texture coordinate set 7     MultiTexCoord(TEXTURE7, ...)
   8+n      texture coordinate set n     MultiTexCoord(TEXTURE0+n, ...)
Table X.1, Generic and Conventional Vertex Attribute Mappings.  For each
row, the current value of the conventional attribute becomes undefined
when the corresponding generic attribute is set, and vice versa.
Attribute zero corresponds to the vertex position and has no current


Thanks. I managed to miss that.