Diagonal Streak in Texture Mapping a GL_QUAD

All appears well in texture mapping a quad checkerboard with four points to a rectangle using GL_LINEAR. (e.g. the checkerboard sample in the Red Book.) The OpenGL pipeline tessellates the GL_QUAD to two triangles under the hood but this is not seen. Interestingly, when the rectangle is converted to a trapezoid by moving one vertex, the result is poor. The tesselation is done in an implementation specific way and generates a diagonally appearing artifact or streak. That is, the trapezoid’s diagonal artifact is apparent in one of two possible directions depending on the board: Wildcat, nVidia Quadro, HP fx6, Matrix G400 etc., but is always there.

Aside from tessellating this myself, are there any suggestions as to generating a better texture mapped result to the trapezoid? It would be helpful if all 4 points were included in a bilinear interpolation so the texture appeared smooth. Are their any nVidia extensions?

[This message has been edited by iss (edited 06-02-2001).]

No, you can’t rely on the interpolation for quads or polygons; there is no one way to do things, and one thing you are very unlikely to see is bilinear interpolation across a quad. Most implementations break up quads into triangles.

If you want bilinear interpolation of texcoords, or anything else like that, you need to tessellate yourself and get the effect you want.

  • Matt

You can use four-value texture coordinates and use the w perspective value to avoid the diagonal artifact – but then instead you get perspective warping, which might not be what you want.

iss,

As a follow-on to what jwatte said, you can check out the ‘qcoord’ demo in the NVIDIA OpenGL SDK, or you can get it from http://www.r3.nu/~cass/qcoord/ in a much smaller download - and with a little html documentation to boot.

Thanks -
Cass

The information on normalized texture coordinates is interesting. As you alluded, the perspective adds another effect.

Thanks to all.
iss