PDA

View Full Version : glVertexAttribPointerARB



skynet
05-20-2003, 10:51 AM
Im trying to use

glVertexAttribPointerARB(9,stream.num_components,s tream.type,GL_FALSE,stream.stride,vbuffer->m_pointer+stream.offset);
glEnableVertexAttribArrayARB(9);

instead of the clumsy:

glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(stream.num_components,stream.typ e,stream.stride,vbuffer->m_pointer+stream.offset);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTextureARB(GL_TEXTURE0_ARB);

inside the vertex program I use

"ATTRIB tangent = vertex.attrib[9];\n"

The program compiles and the call to glVertexAttribPointer() does not produce an error. vbuffer->m_pointer is NULL for VBO objects (which get bound just before). As the ARB_vertex_program specs require, I do not mix the generic attribute and the _belonging_ vertex attribute, but I do mix generic attributes and standard vertex attribute (through glVertexPointer() for instance) in general.

The problem is, as soon as I use a single generic attribute (like shown above) I get a nullpointer exception inside ATIOGLXX.dll (Im using the latest 3.4 catalyst drivers on a R9700). The exception occures inside a glDrawRangeElements() call. The indices are not stored inside a VBO. The whole thing works as soon as I use standard glTexCoordPointer() calls.

What am I doing wrong? Did I miss something?
Do the specs require to specify all-or-nothing with glVertexAttribPointerARB() ?

thanks in advance

Korval
05-20-2003, 11:08 AM
Try using attributes 6 and 7 for your binormals/tangents. These are guarenteed by the spec to always work when using regular vertex arrays.

Using attribute 9 ought to work, as long as you didn't change texture coordinate 1's vertex state (ie, call glTexCoordPointer in the context of texture unit 1). Could be an aliasing bug in ATi's implementation. But 6&7 really should work.

skynet
05-20-2003, 03:01 PM
using attrib 6, 7 and the usual normalarray magically works! I wonder if its a bug in the drivers...