OpenGL Texture Coordinates
I need help getting the texture coordinate arrays to work properly in OpenGL.
this is the content of my coordinate array
1.000000 1.000000
0.000000 1.000000
0.000000 0.000000
1.000000 1.000000
0.000000 0.000000
1.000000 0.000000
I call this array like the following
glTexCoordPointer(2, GL_FLOAT, 0, TexCoords);
Here is the output...
On left is what it should look like, the right is what i''m actually getting
It might be worth noting that I use indexed vertex arrays.
This is what the vertex array looks like...
1.000000 1.000000 0.000000
1.000000 -1.000000 0.000000
-1.000000 -1.000000 0.000000
-1.000000 1.000000 0.000000
this is what the index array looks like....
0 3 2
0 2 1
it is called like this....
glVertexPointer(3, GL_FLOAT, 0, Vert_public);
glDrawElements(GL_TRIANGLES, header.numFaces*3, GL_UNSIGNED_INT, index);
''Vert_public'' is the vertex array, and ''index'' is the index array.
I''m so very desperate right now, any assistance at all is helpful, i''ve been over this a million times, and can''t figure it out.
Seems strange to me that you are treating your position array as indexed, but your texcoord array as non-indexed. Is this right?
xyzzy
xyzzy
yeah... each vertex can have only one texture-coord/normal/colour/etc ... so you should only have 4 texture-coords (8 values) in your array.
If you want to use different tex-coords for the same vertices, you must have separate tex-coord arrays, and make extra calls to glDrawElements (changing the tex-coord pointer between these calls)... pain in the arse, I know, but its the only way to do it using vertex arrays
If you want to use different tex-coords for the same vertices, you must have separate tex-coord arrays, and make extra calls to glDrawElements (changing the tex-coord pointer between these calls)... pain in the arse, I know, but its the only way to do it using vertex arrays
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement