is this 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 11:42 UTC
Read the original article Hit count: 196

Filed under:
|

Hey all Just trying to work out how to use this function glTexCoordPointer.

Here is the man pages http://www.opengl.org/sdk/docs/man/xhtml/glTexCoordPointer.xml which 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? like this

glTexCoordPointer(1, GL_FLOAT, 6, reinterpret_cast(29 * sizeof(float)) );

for the fifth element on the 2nd quad first row. any help is thankful

© Game Development or respective owner

Related posts about c++

Related posts about opengl