Jump to content
  • Advertisement
Sign in to follow this  
juglar

GL_TRIANGLE_STRIP and texcoord

This topic is 4109 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys!! y have the follows vertex to draw a square with triange strip, when i try to put the textcoord i get bat texture mapping, can anyone tell me what are the textcoord for this vertes liste in GL_TRIANGLE_STRIP txs in advance! vtx1: x: 0 y: 10 z: 0 vtx2: x:0 y:10 z:10 vtx3: x:10 y:10 z:0 vtx4: x:10 y:10 z:10

Share this post


Link to post
Share on other sites
Advertisement
The texture coordinates depend on how you want them to be mapped..

I guess you want vtx-1 to be the lower left corner of the texture image.
Your strip looks like that, when you look at it from above, cause its a square lying on the x-z-plane.


vtx3 -----> vtx4
^
|
|
|
|
vtx1 -----> vtx2


Sorry, the diagram is ugly [lol]

The texture coordinates now have to be set up so that the texture is mapped onto the strip in the right order, and that is:
vtx1 - glTexCoord2f( 0.0f, 0.0f );
vtx2 - glTexCoord2f( 1.0f, 0.0f );
vtx3 - glTexCoord2f( 0.0f, 1.0f );
vtx4 - glTexCoord2f( 1.0f, 1.0f );

Share this post


Link to post
Share on other sites
Hi! i draw the Trigles strip in that way (ignore de dots)

vtx2.........vtx4
^ |..........|^
|....|.......|
|.....|......|
|......|.....|
|.......|... |
|..........|.|
vtx1.........vtx3

te secuense is lije this: vtx1--> vtx2-->vtx3-->vtx4


that is the order i have now ... and i can't figure out how to put the corretct texture mapping coord :( can you help me?

txs! in advance
PS: My draw is worst!:P

Share this post


Link to post
Share on other sites
Hey,

textures are mapped onto a rectangle(as this is one) as if you'd glue them onto the vertices. A texture has coordinates in x and y direction (which are then calles s and t or u and v) like this:

t ^
1.0 |
|
| heres the image..
|
|
0.0 |________________>
0.0 1.0 s


That means if you put that onto your triangle strip it looks like that

t ^
1.0 | vtx2.........vtx4
| ^ |..........|^
| |....|.......|
| |.....|......|
| |......|.....|
| |.......|... |
| |..........|.|
0.0 | vtx1.........vtx3
--------------------->
0.0 1.0 s


So here you are (first parameter is s, second t):
vtx1 - glTexCoord2f( 0.0f, 0.0f );
vtx2 - glTexCoord2f( 0.0f, 1.0f );
vtx3 - glTexCoord2f( 1.0f, 0.0f );
vtx4 - glTexCoord2f( 1.0f, 1.0f );

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!