What's the difference among normal texture, RECT texture and CUBE texture?

When I read the source codes written by others. I’m puzzled by the types of texutre: normal texture, RECT texture and CUBE texture. Could you help me clarify these concepts?
Thank you in advance.

hey dean, here’s a short answer:

texture 1D, 2D, 3D: simply the dimensionality of the texture target, just as you would expect. texture coordinate s for 1D, (s,t) for 2D, and (s,t,r) for 3D.

texture RECT: same as 2D, except texture size restrictions are relaxed (don’t need to be power of 2), and texture coordinates are not normalized as with normal 2D.

texture CUBE: a hollow cube consisting of 6 texture faces. texture coordinates are vectors (s,t,r), and treated as though they originate from the center of the cube. you could think of cube maps as a way to encode a function that maps directions to RGBA (or some other flavor).

it’s all in the spec:


Thanks for your replies!