Archived

This topic is now archived and is closed to further replies.

Nevermind last one, Which texture coords needed for triangle strip or quad strip?

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

Recommended Posts

Assume a quad strip is being created in the following manner (if this is wrong, then tell me if there is a better way): glBegin(GL_QUAD_STRIP); glVertex3f(p1.x, p1.y, p1.z); glVertex3f(p2.x, p2.y, p2.z); for(int i=0; i < striplength; i++) { p1 = a new bottom left coord; p2 = a new bottom right coord; //Each time we add these two new points, a quad is created glVertex3f(p1.x, p1.y, p1.z); glVertex3f(p2.x, p2.y, p2.z); } glEnd(); Where would the glTexCoord2f() calls go, how many calls would there be, and what would the x,y arguments be? I am asking this because every example I have seen uses GL_QUADS to create a square by calling glVertex3f() 4 times, and also calling glTexCoords2f() for each of those 4 vertices. However, with GL_QUAD_STRIP, a new quad is created with every TWO (and not FOUR) calls to glVertex3f(). So where would the calls to glTexCoord2f() go? And what would the x,y values be? Thanks Pontius

Share on other sites
you should've just responded to the same thread.

anyway, you don't need glTexCoord2f(...) unless you are doing texture mapping. if you aren't making any calls to glBindTexture or loading bitmaps to use as texture maps you don't need glTexCoord2f(...)

but, in answer to your question, each call to glVertex3f(...) should get it's own glTexCoord2f(...)

http://fly.cc.fer.hr/~unreal/theredbook/
it's in chapter 9: texture mapping

-me

[edited by - Palidine on January 22, 2003 7:21:29 PM]

Share on other sites
Thanks, a few things

I am doing texture mapping, so I do need calls to glTexCoord2f

I read the Red Book, it doesn''t say anything about triangle or quad strips. I''ve gone through some examples that attempt to display a texture over a terrain, but I still can''t get it.

I know that I am creating and loading the texture properly, because if I do something like:

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TexName);
glutSolidTeapot(1.0);

The texture is indeed mapped onto the polygons of the teapot. It''s just when I''m trying to map the texture to my terrain, which is a quad strip, the texture doesn''t show up. I think it has something to do with the coordinates I''m supplying.

So, with that, are there any examples on draping one big texture over a terrain that is either a quad strip or triangle strip? because the red book has no such example

Share on other sites
Nevermind, I figured it out. Looks amazing! Thanks

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632997
• Total Posts
3009797
• Who's Online (See full list)

There are no registered users currently online

×