MIRRORED_REPEAT

The algorithm for this mode is a little more complicated. If the coordinate's integer portion is even, the texture coordinates will be the same as they were with REPEAT. If the integer portion of the coordinate is odd, the resulting coordinate is 1 minus the fractional portion of the coordinate. This results in a texture that "flip-flops" as it repeats, with every other repetition being a mirror image:

As we mentioned earlier, these modes can be mixed and matched. For example, consider the following code snippet:

gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

This would produce the following effect on the texture from the sample:

Samplers Versus Textures

Wondering why the shader uniforms are called samplers instead of textures? A texture is just the image data stored on the GPU, while a sampler contains all of the information about how to look up texture information, including filter and wrap modes.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.252.8