View Full Version : Texture skewing...
08-20-2001, 01:50 PM
I have a relatively large texture (1024 x 1024) mapped onto a quad. The problem I have is that it looks like it's distorted along the diagonal. I'm assuming that OpenGL triangulates quads internally. The texture distortion looks like it follows the edge from the triangulation. Is there any way to remedy this?
I wouldn't have thought OpenGL triangulated quads internally (provided you were specifying GL_QUADS) unless maybe it was the hardware drivers that did it to optimise for the car you're running...
I've never experienced the problem you describe, unless maybe it's your texture mapping quality - try using GL_LINEAR if you are using GL_NEAREST, although I'm not sure thats the cause in this case.
edit: If your quad isn't all on the same plane, then that could cause problems.
[This message has been edited by Mezz (edited 08-20-2001).]
08-20-2001, 02:47 PM
If your quad is not rectangular then read this message.
08-21-2001, 06:10 AM
Actually, the quad is square. I switch to an ortho projection, map its vertices to 0, 0, 0 and 600, 600, 0 (so it's planar). I'm already using GL_LINEAR. Anybody else have any ideas?
08-21-2001, 08:17 AM
Are your texture coordinates deltas the same?
That is, is the difference in s coordinates on one edge the same as the difference in the s coordinates on the opposite edge? Likewise for the differences in the t coordinates. If ds or dt is different for any two opposite edges then you still need to use the q coordinate. In this case the math will be a little different since you would have effectively the inverse of what that link above points to.
Otherwise, you may simply be having small round off errors in your texture coordinates if you are not purposefully choosing a non-rectilinear texture boundary. In that case snap the cross diagonal texture coordinates with the diagonal texture coordinates.
The vertex positions themselves could likewise also have small round off errors making the quad non-rectilinear. You may or may not be able to snap the quad to perfect shape.
[This message has been edited by DFrey (edited 08-21-2001).]
08-21-2001, 11:02 AM
I fixed it, I fixed it! Actually, it was a silly mistake. I have a 3d object that's environment-mapped, and I have glEnable(GL_TEXTURE_GEN_S) and glEnable(GL_TEXTURE_GEN_T) to setup environment-mapping. All I had to do was to disable both before drawing my other textured object, and then re-enable them after. Silly me. http://www.opengl.org/discussion_boards/ubb/wink.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.