Sign in to follow this  
noatom

Texture getting distorted

Recommended Posts

noatom    927
So the plan goes like this:

I have a rectangle that stretches from one side of the screen to the other (in width).And the height is 100.

The texture coords go like this:
0.0f,1.0f
1.0f,1.0f
0.0f,0.0f
1.0f,0.0f

So at my current resolution,the width of the rectangle would be 1280 and of course, 100 in height.

I'm trying to set this image as the texture to be used on that rectangle:
http://www.flickr.com/photos/zooboing/5236655811/sizes/o/in/photostream/


The problem is that the image gets very distorted! What is the solution? I tried tiling too,the same result,ugly distorsion!

Share this post


Link to post
Share on other sites
apatriarca    2365
You have a square texture and you are rendering it on top of a rectangle with a large ratio between the two sides (1280:100). I would be very surprised if there was no distortion. You should change your texture coordinates so that several copies of the texture are inserted in that rectangle (you should also set your texture address mode to wrap). Your texture coordinates can be for example:

0.0f, 1.0f
12.8f, 1.0f
0.0f, 0.0f
12.8f, 0.0f

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this