• Advertisement

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 5509 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

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 this post


Link to post
Share on other sites
Advertisement
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(...)

please read the opengl redbook section on texture mapping:
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 this post


Link to post
Share on other sites
Thanks, a few things

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

I am loading textures and doing calls to glBindTexture


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 this post


Link to post
Share on other sites

  • Advertisement