I have a textured quad that I want to divide in smaller quads for better lighting.
How do I draw it ? I tried with a quad strip, but what about texture coords?
This is what I do for my simple quad:
Texture.Enable;
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(0,0);
glTexCoord2f(1, 0); glVertex2f(100,0);
glTexCoord2f(1, 1); glVertex2f(100,100);
glTexCoord2f(0, 1); glVertex2f(0,100);
glEnd;
Antonio
November 14, 2000, 3:43pm
2
I think you’ll have to generate texture coordinates in proportion with the new quads. So if you divide the original quad into four quads, you’ll have to map a quarter of the texture to each quad. For instance
glTexCoord2f(0, 0); glVertex2f(0,0);
glTexCoord2f(0.5, 0); glVertex2f(50,0);
glTexCoord2f(0.5, 0.5); glVertex2f(50,50);
glTexCoord2f(0, 0.5); glVertex2f(0,50);
I haven’t tried the above code but I believe the underlying reasoning is correct.
Antonio www.fatech.com/tech