OpenGL has several ways to set the texture mapping, one of the most interesting is called ‘Wrap’ (GL_TEXTURE_WRAP_?) This feature indicates how that is going to repeat the texture or be mixed with the border color when they exceed the specified coordinates [0, 1].
Here we offer a brief description of the various wrap modes in OpenGL:
- GL_CLAMP: Clamps the texture coordinate in the [0,1] range. In the limits the color of texture is combined with the color of the edge.
- GL_REPEAT: Ignores the integer portion of the texture coordinate, only the fractional part is used, which creates a repeating pattern. This is the default value.
- GL_CLAMP_TO_EDGE: Sets the texture coordinates to [1/2N] (where N is the size of the texture) texels within the texture. This prevents to draw the border color. Available since OpenGL 1.2.
- GL_CLAMP_TO_BORDER: Sets the texture coordinates to [1/2N] (where N is the size of the texture) texels outside the texture. This allows to draw the border color without mixing with the texture color. Available since OpenGL 1.3.
- GL_MIRRORED_REPEAT: The coordinates are set to the fractional part of the texture coordinate if the integer part is even; if the integer part is odd, then the texture coordinate is set to 1 – the fractional part of the texture coordinate. Available since OpenGL 1.4, or with GL_ARB_texture_mirrored_repeat extension, or since OpenGL ES 2.0, or with OES_texture_mirrored_repeat extension.
Note: The sample image has the border color set to red (GL_TEXTURE_BORDER_COLOR) so you can well appreciate it.
No hay comentarios:
Los comentarios nuevos no están permitidos.