Multiple texture coordintes

Recommended Posts

I'm trying to do hardware vertex morphing, and I'm stuck on how to pass texcoords to the vertex shader. I'm not using VBOs, I'm simply drawing a list of vertices with their connectivity with glDrawElements(). I've tried both:
glVertexAttribPointerARB(0, 3, GL_FLOAT, GL_FALSE, 0, dstMeshVerts);
glEnableVertexAttribArrayARB(0);

glVertexAttribPointerARB(1, 3, GL_FLOAT, GL_FALSE, 0, dstMeshNormals);
glEnableVertexAttribArrayARB(1);

//   and    //

glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(3, GL_FLOAT, 0, (float*) dstMeshVerts);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glClientActiveTexture(GL_TEXTURE2);
glTexCoordPointer(3, GL_FLOAT, 0, (float*) dstMeshNormals);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);


Is there a way to do this without VBOs? I'm used to using DirectX so there's probably an obvious mistake I'm making.

Share on other sites
I think you are a bit confused here, you don't need VBOs to send texture coordinates or any vertex attributes to a shader. You can even use immediate mode if you wanted to.

Make sure you bind your attribute locations for GLSL or whatever Cg needs if you are going to use generic attribute locations vs. built in ones. Look at glGetAttribLocation()

glEnableClientState(GL_VERTEX_ARRAY);glVertexPointer(3, GL_FLOAT, 0, Vertices);glEnableClientState(GL_NORMAL_ARRAY);glNormalPointer(GL_FLOAT, 0, Normals);glClientActiveTexture(GL_TEXTURE1);glEnableClientState(GL_TEXTURE_COORD_ARRAY);glTexCoordPointer(2, GL_FLOAT, 0, TexCoords1);glClientActiveTexture(GL_TEXTURE2);glEnableClientState(GL_TEXTURE_COORD_ARRAY);glTexCoordPointer(2, GL_FLOAT, 0, TexCoords2);glDrawElements();glDisableClientState(GL_TEXTURE_COORD_ARRAY);glClientActiveTexture(GL_TEXTURE1);glDisableClientState(GL_TEXTURE_COORD_ARRAY);glDisableClientState(GL_NORMAL_ARRAY);glDisableClientState(GL_VERTEX_ARRAY);

Share on other sites
Ah, thanks. I didn't think they were related, but every example I saw was using VBOs so I was unsure.

I tried that example, but I got runtime errors for:

glClientActiveTexture(GL_TEXTURE1);

I'll give it another go in the morning.

Edit: tried it again this morning and now I'm not getting a run time error, and it works just fine.

[Edited by - glaeken on March 25, 2008 10:47:14 AM]

Create an account

Register a new account

• Forum Statistics

• Total Topics
627704
• Total Posts
2978716

• 21
• 14
• 12
• 10
• 12