View Full Version : mapping textures on GL_QUAD_STRIPs
Tolga Dalman
09-30-2001, 06:21 PM
hello,
does anyone know an efficient solution for my problem? i want to put textures on a quadstrip, one for each square.
currently, i'm using something like the following code:
//
for(x=0; x<MAX_X; x++)
{
glBegin(GL_QUAD_STRIP);
glVertex3f(x,y,z1);
glVertex3f(x,y+,z2);
glEnd();
}
//
anyone an idea? please help...
tnx
bye, tolga.
First, two vertices won't make a quad, you mus put glBegin/glEnd outside the for-loop.
Do you mean you want different textures on different quads in the quad strip? That's not possible, since you are not allowed to change texture while drawing a primitive.
If you want the same texture but repeated, just put a glTexCoord before each glVertex that uses x as counting cariable.
glBegin(GL_QUAD_STRIP);
for(x=0; x<MAX_X; x++)
{
glTexCoord2f(x, 0);
glVertex3f(x,y,z1);
glTexCoord2f(x, 1);
glVertex3f(x,y+,z2);
}
glEnd();
Something like that. This will repeat the same texture over each quad.
Tolga Dalman
10-01-2001, 07:22 AM
hi
of course, i wrote something wrong last night. glBegin(..) and glEnd() have to be outside the loop...
tnx anyway. very bad thing, that i can't change my texture.
but wait. is it possible to use one large texture?
look:
//
glBegin(GL_QUAD_STRIP);
for(x=0; x<MAX_X-1; x++){
glTexCoord2f(x/MAX_X,y/MAX_Y);
glVertex3f(x,y,z1)
glTexCoord2f(x/MAX_X,y/MAX_Y);
glVertex3f(x,y+1,z2)
}
glEnd();
//
dependant, on what i need, this should be possible, yes?
btw, do you know about texture max_size and max_number limitations in opengl? or rather in mesa?
Gavin
10-01-2001, 07:33 AM
depends on your graphics card. I know on mine its 2048. Can't remember the call for querying the max tex size, not on my pc at the mo.
gav
Evil-Dog
07-18-2002, 12:38 PM
Hey Tolga
What's up !
I just want your new email. http://www.opengl.org/discussion_boards/ubb/smile.gif
Sorry for the lame post ! hehehe
---------------------------------
Evil-Dog
*Let's have a funny day"
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.