Skip to main content
GameDev.net gamedev.net
🔒 Locked

Image without streching

Started by nildo Jun 3, 2003 at 7:56 AM 2 replies 550+ views
Original Post
nildo
nildo
First of all hello ! Well. I am loading images to make my floor. The problem is: I want to repeat the image many times until the floor finishes. But the imaging is getting streched. glBindTexture(GL_TEXTURE_2D, texChao); glBegin(gl_quads); glNormal3f( 0.0, 1.0, 0.0); glTexCoord2f(0.0, 1.0); glVertex3D((iWidth div 2) * -1, chao_EixoY, 2); glTexCoord2f(0.0, 0.0); glVertex3D((iWidth div 2) * -1, chao_EixoY, iHeight * -1); glTexCoord2f(1.0, 0.0); glVertex3D((iWidth div 2), chao_EixoY, iHeight * -1); glTexCoord2f(1.0, 1.0); glVertex3D((iWidth div 2), chao_EixoY, 2); glEnd; How to do ?
Brother Bob
Brother Bob
Change the texture coordinates. They are the ones defining how the texture is mapped to the quad. For example, change 1.0 to 2.0 to repeat the texture two times.
_walrus
_walrus
also make sure to that this is the code in your texture object setup (as opposied to specifing gl_CLAMP_TO_EDGE or GL_CLAMP) . If not specified GL_REPEAT is the default.

glBindTexture(GL_TEXTURE_2D, texChao);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);






[edited by - _walrus on June 3, 2003 9:25:44 AM]
Count_Zero
Count_Zero
Can you indicate on which axis the textures are being stretched, as that might help.

A couple of questions...

Are your quads intented to be squares, if so, is it worth displaying the tiles without the textures - to check whether it is the texture or the quad that is being stretched?

is your original image for the texture a square to begin with?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.