Hi all,
I have a small graphics library based on OpenGL which I use for
educational purposes. For drawing primites, the library uses vertex
arrays, using glVertexPointer, glNormalPointer and glTexCoordPointer
functions.
The problem is that these functions are now deprecated, and I should use
vertex attributes instead. Looking on the web, I came up with this link:
http://www.opengl.org/registry/specs/ARB/vertex_program.txt
which states (Section 2.7):
Implementations may, but do not necessarily, use the same storage for
the current values of generic and certain conventional vertex
attributes. When any generic vertex attribute other than zero is
specified, the current values for the corresponding conventional
attribute in Table X.1 become undefined. Additionally, when a
conventional vertex attribute is specified, the current values for the
corresponding generic vertex attribute in Table X.1 become undefined.
For example, setting the current normal will leave generic vertex
attribute 2 undefined, and vice versa.
and gives the following table:
Generic
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, ...)
Now my question :-) Reading the above quote, it is safe to assume these
transformations in the code will work (on all platforms, that is)?
glVertexPointer(...) -> glVertexAttribPointer(0, ...)
glEnableClientState(GL_NORMAL_ARRAY) -> glEnableVertexAttribArray(2)
glNormalPointer(...) -> glVertexAttribPointer(2, ...)
glClientActiveTexture(GL_TEXTURE0) -> glEnableVertexAttribArray(8)
glTexCoordPointer(...) -> glVertexAttribPointer(8, ...)
thanks in advance,
anton