Re: TEXTURE COORDINATES

New Message Reply Date view Thread view Subject view Author view

Wayne Price (wayne++at++miramar.demon.co.uk)
Mon, 27 Jul 1998 23:32:34 +0100


Andreas.Ekstrand++at++saab.se wrote:

> I don't know if I've missed or forgotten important parts of
> the course in computer graphics a couple of years ago. What
> I do know is that I can't seem to figure out how the S, T,
> R and Q texture coordinates work.

They are the equivalent of X, Y, Z and W vector coordinates. Probably
not the best description, so...

For the simplest case of just using S and T (ie. 2D texture), the
coordinates are valid in the range 0.0 to 1.0, and these map to the
entire texture image. So we have
        S, T = 0.0, 0.0 = bottom left texel
        S, T = 1.0, 0.0 = bottom right texel
        S, T = 0.0, 1.0 = top left texel
        S, T = 1.0, 1.0 = top right texel.
So when you draw a polygon, each vertex should have a texture coordinate
also. This will map that part of the texture to that coordinate and do
interpolation for the in-between parts (not the best description, but
I hope you can see what I mean).

Now when I said valid earlier, that's not strictly true. There are
several texture clamping modes which can be used. CLAMP (can't remember
the exact token offhand) will limit the S, T to the range 0.0, 1.0.
WRAP will just wrap them around allowing you to repeat the texture (ie.
S = 0.4 will be the same texel as 5.4 or even 10000.4).

When you bring R into play, you have a texture cube, and the same
applies for the third coordinate, range 0.0 to 1.0, and limited or
wrapping.

Q is equivalent to W in vertex coordinates and I've not really had the
reason to mess with this one so maybe someone else can help here.

> I hope that someone is willing to explain this to me, in a
> simple way.

Hope the above is understandable...

Wayne

-- 
________________________________________________________________________
Wayne Price         W.Price++at++miramar.demon.co.uk        Virtual Magic Ltd
Mobile: +44 (0) 370 376383                     Home: +44 (0) 1483 531235
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:44 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.