OpenGL Texture coordinate arrays
by Sam Hinton · in Technical Issues · 12/14/2000 (6:45 pm) · 3 replies
I'm using OpenGL and have had a lot of success with vertex arrays, colour arrays and the glDrawArrayElements function, but I cannot for the life of me work out why the texture coordinate array isn't working.
Does anyone have any information on what format the texture coordinate array needs to store data?
I am assuming it is like this:
(Assume f1 means "face 1", and "v1" means vertex 1, so f1v1_s is the 's' coord for the first vertex in face 1. Each face has three vertices (a triangle).
texturecoordinates =
{ f1v1_s, f1v1_t, f1v2_s, f1v2_t, f1v3_s, f1v3_t, f2v1_s, etc... }
Is this right? I am finding that when I try to map textures onto a cube using these values, I don't get the texture showing up - I just get the edge colours of the texture.
It's not a wrapping problem, because I have no problems specifying the textures for a quad manually. I can't find the answer in any of the doco for open GL. It all seems to brush over the texture coord array discussion by saying it works like the vertex arrays!!
Does anyone have any information on what format the texture coordinate array needs to store data?
I am assuming it is like this:
(Assume f1 means "face 1", and "v1" means vertex 1, so f1v1_s is the 's' coord for the first vertex in face 1. Each face has three vertices (a triangle).
texturecoordinates =
{ f1v1_s, f1v1_t, f1v2_s, f1v2_t, f1v3_s, f1v3_t, f2v1_s, etc... }
Is this right? I am finding that when I try to map textures onto a cube using these values, I don't get the texture showing up - I just get the edge colours of the texture.
It's not a wrapping problem, because I have no problems specifying the textures for a quad manually. I can't find the answer in any of the doco for open GL. It all seems to brush over the texture coord array discussion by saying it works like the vertex arrays!!
#2
You would think that such a critical feature would get a little better treatment in the texts wouldn't you? In the OpenGL Superbible - which is otherwise a really good book - texture coordinate arrays only get a brief mention... gah!
I'll keep playing. I'm sure I'll crack this problem, and when I do I'll post the solution.
12/15/2000 (1:18 am)
Well at least I know I'm not just being stupid, or at the very least, I'm not the ONLY one being stupid ;)You would think that such a critical feature would get a little better treatment in the texts wouldn't you? In the OpenGL Superbible - which is otherwise a really good book - texture coordinate arrays only get a brief mention... gah!
I'll keep playing. I'm sure I'll crack this problem, and when I do I'll post the solution.
#3
01/04/2001 (3:19 am)
Can you post some code in which the problem occurs?
Torque 3D Owner Pat Wilson