For example, if I am using glTexCoord3f(GLfloat s,GLfloat t,GLfloat r), paramesters s, t, r are supposed to be within the range of 0.0f and 1.0f. But I am wonder whether it will be okay for us to set some values which are beyond this range?
The motivation for doing this is that if I am trying to visualize the cross section of a cube as shown in the following image. The red rectangle 'abcd' is the cross section I am trying to visualize. But I notice that the coordinates of the green rectangle 'ABCD' is a lot easier to get (especially when the plane is not perpendicular to any axis).

I just give that a try. It seems that there is no problem what so ever. But I am still a little bit worry about that though. I don't know whether it is good practice to do so. Whether this is supported by all sort of graphic cards?
OpenGL texture coordiates may be arbitrary values. They will however be clamped, or repeated/wrapped into the range 0…1 depending on the texture coordinate wrap or clamp settings.
Also some texture targets treat texture coordinates differently. GL_TEXTURE_xD behave as one would expect. GL_TEXTURE_CUBE_MAP takes the texture coordinate to be a direction vector. GL_TEXTURE_2D_ARRAY treats the S and T components as usual, but the R component as a layer index. GL_TEXTURE_RECTANGLE treats the texture coordinates as pixel indices into the texture image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With