PDA

View Full Version : Texture coordinate, u,v and s,t,r... They are asme or not?



reader1
05-11-2015, 12:12 AM
xture coordinate, u,v and s,t,r... They are same or in a differnt space?

reader1
05-11-2015, 03:21 AM
Browsing the command glTexCoord2f(s,t), the parameters s and t are taking value out of texture with coordinate u, v. Thus, I think they are the same thing,

mhagain
05-11-2015, 03:33 AM
They're just different names for the same thing.

Modelling programs and D3D tend to use (u, v) whereas OpenGL tends to use (s, t) but it's just a naming convention. You could name them (x, y) or even (elephant, wombat) and so long as the same data is in there, everything would work.

reader1
05-11-2015, 05:32 AM
So it is. name convention. But opengl books often name the texture coordinate as u,v, whereas when they deal with paramters in glTexCoord*(), they begin to use s,t...terminology, it is too arbitrary to strict.
Thank you for your wonderful,interesting answer.

GClements
05-11-2015, 03:54 PM
Note that GLSL's vector member access uses s,t,p,q for the "texture" version (although you're free to use x,y,z,w or even r,g,b,a if you desire, so long as all members are drawn from the same group).

Documentation consistently uses s,t,r,q, but r conflicts with r,g,b,a so they changed it for GLSL.

The main problem with using u,v is deciding what the third and fourth components would be. Using u,v,w would be fine if we only needed 2D homogeneous coordinates, but the existence of 3D textures and cube maps precludes that. u,v,w,<anything> is unacceptable because w is too firmly established as the projective divisor.

Mathematical texts discussing surfaces don't have this problem, but OpenGL has to address it.

reader1
05-11-2015, 05:41 PM
So that is how it is. Then, how about letter 'h' which is also often used in homogenous coordinate?
We get use to u,v in the complex variable, u=f(x,y), v=g(x,y), or x(u,v),y()...

of cuase we don't mind which are used, no matter they are elephant or tiger...