Sign in to follow this  
Knut

Ortho texture issue

Recommended Posts

Knut    107
Hi all,

I am trying to render a textured quad in ortho mode. When I render it as a rectangle, it works fine, as this picture shows:
[img]https://knut80.files.wordpress.com/2012/09/square11.png?w=404[/img]

However, when I try to move one corner half way to the center, the texture gets weirdly skeeved:
[img]https://knut80.files.wordpress.com/2012/09/square21.png?w=405[/img]

Notice the red line going up. I would think that it should be sloped towards the upper right corner, but it's rendered straight up. Is this normal?
There is only one textured quad in this picture, rendered using fixed function pipeline. The texture coords are all either 0 or 1 in the corners. Why is the texture rendered like this?

Thanks in advance.
Knut

Share this post


Link to post
Share on other sites
Brother Bob    10344
OpenGL can only correctly render planar quads (quads where the four vertices are on a plane). Due to the way the position and texture coordinates interact to form vertices, your quad isn't planar anymore when you shift the position like that without altering the texture coordinate.

Read this: [url="http://www.xyzw.us/~cass/qcoord/"]clicky[/url].

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