PDA

View Full Version : Vertex arrays with texture coordinates



AndersO
04-16-2002, 02:37 AM
Hello all.

When using vertex arrays with texture coordinates, do I need to specify duplicate vertices if a vertex has 2 different texture coordinates?

I.e, if I got two triangles that are sharing vertices but got different texture coordinates on the shared vertices, I need to specify 6 vertices. (Instead of 4 if the same texture coordinates were used).

Or have I missunderstood something?!..

Bob
04-16-2002, 04:53 AM
Yes, they must be duplicated.

AndersO
04-16-2002, 05:26 AM
How awkward. There must be a reason for this?!.. Why wasn't it done so that I could specify indicies for each "thing" for a vertice. One index list for the vertices, one for texture coordinates, one for normals and so on in the glDrawElement call..

Probably some performance reason, right?

So, I need to reorganize my objects vertices I guess.. After the reorganization, the number of vertices, texture coordinates, normals and so on will all be the same?...

Thanks for clearing this up though!.

[This message has been edited by AndersO (edited 04-16-2002).]

Bob
04-16-2002, 05:52 AM
I don't know the reason, nor do I see any real reason not to implement it. Sure there are some reason, since they aren't implemened.

You may gain some flexibility by not having to duplicate vertices, but remember that if you use four attributes (for example, coordinate, normal, and 2x tex coord), you need four times the memory for indices, and most of the indices across the arrays are identical anyways. You may end up consuming more memory than when you duplicate vertices.