Just a Quick Texture problem

Started by
3 comments, last by Marvin 22 years, 6 months ago
How do i stretch a texture over more than 1 polygon, eg have half on one polygon and half of the other, ive tried messing around with texture coordinates, do i have to play around with glTexParameter as well? Thanks
Advertisement
Well, its rather really simple. You need to mess with the Texture Coordinates.

And example could be this

Say you have two quads beside each other, and you want half of the texture to be on one, and have to be on the other, you would do this.

  glBegin(GL_QUADS);// Quad One, with half of the one textureglTexCoord2f(0, 0);glVertex3f(-1, -1, -5);glTexCoord2f(0.5, 0);glVertex3f(0, -1, -5);glTexCoord2f(0.5, 1);glVertex3f(0,  1, -5);glTexCoord2f(0, 1);glVertex3f(-1,  1, -5);// Quad Two, with half of the one textureglTexCoord2f(0.5, 0);glVertex3f(0, -1, -5);glTexCoord2f(1, 0);glVertex3f(1, -1, -5);glTexCoord2f(1, 1);glVertex3f(1,  1, -5);glTexCoord2f(0.5, 1);glVertex3f(0,  1, -5);glEnd();  
"...."
yes, thats just what i''ve been trying :/

maybe its because i want to tile the texture and have it repear, as in my other post at the mo if almost looks as if the texture''s being clamped.
Ok heres the actual problem..

as you may see in the picture bellow, the texture isnt stretched at all, i need it stretched accross the poly's where the line is.

The picture bellow is using the texture coordinate system explained above.

Any ideas? it looks like clamping but clamping is off

if it helps im using Vertex Arrays and MultiTexturing

Thanks



Edited by - Marvin on October 13, 2001 3:48:49 PM
Fixed, all it needed was 2 little (float) casts

This topic is closed to new replies.

Advertisement