What is the correct way to use glTexCoordPointer?
Posted
by
RubyKing
on Game Development
See other posts from Game Development
or by RubyKing
Published on 2012-03-30T10:19:44Z
Indexed on
2012/03/30
23:43 UTC
Read the original article
Hit count: 203
I'm trying to work out how to use this function glTexCoordPointer
.
The man page states that I must set a pointer to the first element of the array that uses the texture cordinate.
Here is my array:
static const GLfloat GUIVertices[] = {
//FIRST QUAD
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f,
-1.0f, 0.94f, 0.0f, 1.0f, 0.0f, 1.0f,
1.0f, 0.94f, 0.0f, 1.0f, 1.0f, 1.0f,
//2ND QUAD
// x y z w X Y
1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f,
-1.0f, -0.94f, 0.0f, 1.0f, 0.0f, 1.0f,
1.0f, -0.94f, 0.0f, 1.0f, 1.0f, 1.0,
};
But how do I set the pointer correctly for the fifth element on the 2nd quad first row? I was thinking something like this:
glTexCoordPointer(1, GL_FLOAT, 6, reinterpret_cast<const GLvoid *>(29 * sizeof(float)));
© Game Development or respective owner