OpenGL Texture Arrays Revisited

Started by
3 comments, last by Hairu 22 years, 4 months ago
How can I texture something like a box using texture coordinate arrays? I want the same texture to be applied to every side of the box.
Advertisement
you mean in combination with Vertex Arrays?
well, you''ll have to send the texcoord along with every vertex. so the index to the vertex would be the same index as the texturekoordinate of the vertex.
It seems a bit of a waste to save those over and over again... but in most games there aren''t a lot of similar texture koordinates so it just wouldn''t be worth the trouble.

cya,
Phil


Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states )
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
You will have to make new copies of the vertices with the different texture coordinates.

A box is the WORST case scenario for vertex array. A nice mesh will have less replicating vertices if any.

I create my vertex arrays like this :

for each faces     for each vertexInFace            If vertex is not in the array                Add vertex along with TexCoord and Normal            else                if TexCoord are the same                    Average Normal                 else                     Add Copy of vertex along with texCoord and Normal.                     Change indices in face to new vertex position in array 


Edited by - Gorg on November 26, 2001 4:16:49 PM
When I try this, my coordinates get all messed up. I think it''s because in order to texture a cube, and most objects, each vertex must have more than one tex coordinate assigned to it. This seems to mess tex coord arrays up. Do you know of a way to get around this?

Also, is it possible to texture an object without using texture coordinate arrays and still use vertex arrays? Using the glTexCoord2f() function, or something similar?


Ahh! that does seem as if it will work! But wont I be redrawing alot of unnecessary things?

This topic is closed to new replies.

Advertisement