In the previous section, we used texParameteri to set the filter mode for textures but, as you might expect from the generic function name, that's not all it can do. Another texture behavior that we can manipulate is the texture wrapping mode.
Texture wrapping describes the behavior of the sampler when the texture coordinates fall outside the range of 0 and 1.
The wrapping mode can be set independently for both the S and T coordinates, so changing the wrapping mode typically takes two calls:
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
Here, we're setting both the S and T wrapping modes for the currently bound texture to CLAMP_TO_EDGE, the effects of which we will see in a moment.
As with texture filters, it's easiest to demonstrate the effects of the...