View Full Version : Vertex array problems

02-06-2004, 11:50 AM
This is probably a simple problem, answered a thousand times over, but it's new to me. Using Vertex Arrays, OpenGL expects only one texture coordinate per vertex. Unfortunately, something simple like a cube tends to break down if you use that format (ie: two corners can't share the same texture coordinate). My question is how do you avoid this problem?

02-06-2004, 04:52 PM
Im not sure I fuly understand, but is it that you want a face on the cube to have like one part of the texture, and an adjacent face of the cube to have a totally different part of the texture, so that the tex coords of the 2 shader verteces are different?
If so, then I THINK (I may be wrong) that the only solution is to duplicate the verteces, so that they have the same position, but different tex coords.

You may also be able to hack someting together with multitexturing.

02-06-2004, 05:55 PM
Hrmmm...no. Not quite to the point of vertex shading yet. ^_^

Anyway, here's what I'm trying to do (or at least a simplifies form). I have a list of vertices and indices which map out a cube. I know they do and work. However, for each index, I would normally have a texture coordinate, but since OpenGL requires the texture coordinate array have a coordinate for each vertex, not index, some of my texture coordinates are really off.

I've seen a bunch of people mentioning cube mapping (already lost on that), and that might fix the problem, but I have no idea how to implement it.

So, I'm not sure if that was any clearer, but I hope it was. Like I said, I'm sure it's a simple question with a simple answer. I just don't have much experience with vertex arrays.