Texturing Quads

hi there,

i have a strange problem while using
quads, if i have a quad with 2
vertices very close to each other then
the texture is applied as if it were a
triangle rather than the texture being
progressivly narrower as it gets towards the
apex.

hope you can understand this

cheers

Mark.

This sounds like normal behavior to me. See, if you stretch (or squeeze) the texture along one edge but not the other, the hardware will interpolate the texture of each triangle of the quad differently. To compensate for that difference you need to use the q coordinate of the texture coordinate so that each triangle’s texture will be interpolated in a consistent manner.
There is a link to a site somewhere that descibes this in good detail and shows how to calculate q in this instance. I’ll post that link if I find it.

[This message has been edited by DFrey (edited 08-19-2001).]

http://www.r3.nu/~cass/qcoord/

Cheers DFrey

looks like its what i want.

Hi,
Is’nt this another example of prefering triangles above other polygons?
greetings,
Hofi

No it is not an example of why triangles should be preferred, the exact same problem would appear with individual triangles. After all, the quad is triangulated automatically into either a triangle fan or strip.

Holy crap this q thing actually works … for the most part.

All is fine while the top two verticies are apart. However when the verticies close to the point where my quad becomes a triangle I see just a zoomed bit of the lower left of my texture covering the entire triange and not a squeezed texture. What should I set q to now?

You can’t squeeze it too much because eventually the floating point errors start to become significant. I’m not sure what you can do at that point.

cry?

hi there,

ive found a work around, all my quads are
subdivided (in order to apply dicplacement
maps and greater lighting quality from
patched lights (both of these are to do
this week)) and if you do this to a level
of one or more the problem is drastically reduced.

Mark

hi, it could be a graphics failure of the inner angle of the cam!
if objects are far away of your cam this effect will be if your inner angle of cam is to slow!
so you have to make it bigger (like 1.0f)
in gluLookAt() function!
this is the variable in front of the view-distance! (the outer angle of cam)