Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


OpenGL Texture Arrays Revisited


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Hairu   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 November 2001 - 08:50 AM

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.

Sponsor:

#2 phueppl1   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 November 2001 - 08:57 AM

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 )


#3 Gorg   Members   -  Reputation: 248

Like
Likes
Like

Posted 26 November 2001 - 09:16 AM

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

#4 Hairu   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 November 2001 - 09:17 AM

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?

#5 Hairu   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 November 2001 - 09:21 AM



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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS