Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Eber Kain

Texture Wrap s, t, and r????

This topic is 6103 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The redbook specifys GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, and GL_TEXTURE_WRAP_R. Whats the situation where these different ones can be applied? When he''s best, he''s little worst than a man, When he''s worst, he''s little better than a beast.

Share this post

Link to post
Share on other sites
S, R, T and Q coordinates

S, R, T and Q coordinates are for texture coordinates what X, Y, Z and W are for vertex coordinates.

From OpenGL specifications :

The commands
void TexCoord{1234}{sifd}( T coords );
void TexCoord{1234}{sifd}v( T coords );
specify the current homogeneous texture coordinates, named s, t, r, and q. The TexCoord1 family of commands set the s coordinate to the provided single argument while setting t and r to 0 and q to 1. Similarily, TexCoord2 sets s and t to the specified values, r to 0 and q to 1; TexCoord3 sets s, t, and r, with q set to 1, and TexCoord4 sets all four texture coordinates.

Texture wrapping

GL_TEXTURE_WRAP_i, with i being S, T, or R, set the wrapping mode for each texture coordinate.
GL_CLAMP forces texture coordinates to lie within the [0,1] range (eg, coordinates lower than 0.0f pick a texture coordinate 0, and coordinates greater than 1 pick a texture coordinate 1.0f) whereas GL_REPEAT repeats the texture out of the [0,1] range (for instance, a texture coordinate 1.25 will pick the texture coordinate 0.25).
Note thar both implementations are identical if all texture coordinates lie between 0 and 1.

From OpenGL specifications :

If TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R is set to REPEAT, then the GL ignores the integer part of s, t, or r coordinates, respectively, using only the fractional part. (...) CLAMP causes s, t, or r coordinates to be clamped to the range [0,1].

Hope this helps.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!