/* Draw each mesh of the model */
for (int i = 0; i < md5file.num_meshes; ++i)
{
m_md5Loader.PrepareMesh (&md5file.meshes, zSkeleton);
glVertexPointer (3, GL_FLOAT, 0, m_md5Loader.ReturnVertex());
glDrawElements (GL_TRIANGLES, md5file.meshes.num_tris * 3,
GL_UNSIGNED_INT, m_md5Loader.ReturnIndices());
}
glDisableClientState (GL_VERTEX_ARRAY);
How can you UV map with glVertexPointer?
I'm trying to understand how I can UV map with glVertexPointer. I was reading on MD5meshes work and I got my own md5mesh loader. It reads in the UVs so, I'm just figuring out how to UV map with this:
Thank you hope to get some help, any questions are welcomed as well if you have any about the code. :)
Just to clarify that:
glVertexPointer is for vertex coordinates, nothing else.
To load texture coordinates (UV) you'd need to use glTexCoordPointer - or the generic glAttribPointer with OpenGL 3+.
glVertexPointer is for vertex coordinates, nothing else.
To load texture coordinates (UV) you'd need to use glTexCoordPointer - or the generic glAttribPointer with OpenGL 3+.
glTexCoordPointer()
It takes the same parameters as glVertexPointer (but you point it at your texcoords instead!).
Also note: "To enable and disable a texture coordinate array, call glEnableClientState and glDisableClientState with the argument GL_TEXTURE_COORD_ARRAY."
Also for future reference, http://www.opengl.org/sdk/docs/man/ should be pretty helpful to you. (The see-also section at the bottom is very helpful if you're not quite sure what it is you need)
cheers,
Dan
EDIT: beaten, also TexCoord not Texcoord, doh!
It takes the same parameters as glVertexPointer (but you point it at your texcoords instead!).
Also note: "To enable and disable a texture coordinate array, call glEnableClientState and glDisableClientState with the argument GL_TEXTURE_COORD_ARRAY."
Also for future reference, http://www.opengl.org/sdk/docs/man/ should be pretty helpful to you. (The see-also section at the bottom is very helpful if you're not quite sure what it is you need)
cheers,
Dan
EDIT: beaten, also TexCoord not Texcoord, doh!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement