WebGL - Texture APIs (clamp, repeating, etc)
In this episode, I discuss several texture APIs offered in WebGL.
- Texture APIs: texParameteri
- gl.texParameteri, gl.getTexParameter, gl.generateMipmap
- Mipmaps are used to create distance with objects.
- A higher-resolution mipmap is used for objects that are closer, and a lower-resolution mipmap is used for objects that are farther away.
- It starts with the resolution of the texture image and halves the resolution until a 1x1 dimension texture image is created.
- For example, if you have a 64x64 texture, the next smaller mipmap is 16x16, then 4x4, then 1x1
- We'll be looking at these in more detail in a later episode.
- A texture filter constant to use when a surface is rendered larger than the corresponding texture bitmap (such as for close-up objects). Initial value is gl.LINEAR.
- A texture filter constant to use when a surface is rendered smaller than the corresponding texture bitmap (such as for distant objects). Initial value is gl.NEARESTMIPMAPLINEAR.