PDA

View Full Version : Tri-Strips Texture Coordinate PROBLEM!!!



SS05870
08-27-2002, 08:20 AM
Hi! That's my first time so...don't hurt me :P

I'm working on a 3DS Max 4 Exporter plug-in and after coding ... well, debuging a way to build triangle strips, a PROBLEM came across: ¿How do I get Texture Coordinates correctly to match triangle strips?

Little explanation (Taken from an exported cube with "Box - UVWMapping"):
- Suppose that my resulting strip is: 4 5 7 1 3 0 2 ...
- When you send those vertex indices to OpenGL with "glBegin(GL_TRIANGLE_STRIP)", it builds:

face 4 5 7
face 5 7 1
face 7 1 3
face 1 3 0
face 3 0 2
.... . . .

- Suppose that texture indices to this faces are:

face 4 5 7 - 14 15 16
face 5 7 1 - 5 23 1
face 7 1 3 - 22 20 21
face 1 3 0 - 12 11 13
face 3 0 2 - 10 8 9
.... . . . - . . .

- So, ie: vertex 7 has 3 different texture indices {16, 23, 22} while in my strip structure it's only called once...

I hope to make me understood, with my 2 most powerful weapons: my poor kindergarten english and my privileged crashed apple like IQ

I know that Quake2 model files have tri-strip info, but I don't understand the way it works to get texture coords. It saves again the UV coords? Any volunteers?

And the question is: ¿ How can I assign those different texture coordinates to the same vertex (with OpenGL) ?
Any brighter (happy face, happy face) idea...

Thanks!

Zeno
08-27-2002, 08:41 AM
Unfortunately, there is no way to send more than 1 texture coordinate per texture unit per vertex when drawing triangle strips.

You'll have to split up your strip whenever there are multiple texcoords on a single vertex.

-- Zeno

ToolChest
08-27-2002, 11:22 AM
Usually when exporting from max if the verts are truly on the same poly then 16, 22, and 23 will have the same coords. Don’t forget 16, 22, and 23 are indexes into the true texture coords.

John.

SS05870
08-28-2002, 02:20 AM
Ok, but in the model stripifier code of Quake 2 source I can't see any discriminating code to separate vertices with different texture coordinates although it works (with two floats U and V, followed by a vertex index), I've tried it.

Can someone explain, how can quake 2 models apply strips with textures, to me?

Michael Steinberg
08-28-2002, 02:31 AM
AFAIK, quake 2 models only have 1 texture (skin) which is wrapped around the whole mesh, thus there are no multiple-texture-coordinates per vertex.

SS05870
08-29-2002, 12:15 PM
Almost all of you were right
You have to split the strips where vertices have different texture coord