There are mainly three types of textures: 2D textures (most common), Cubemap textures, and 3D textures. 3D textures are rarely used in gaming applications and are mostly used in volumetric effects such as light rays and realistic fog. We will not discuss 3D textures in this book as they are mostly procedural. To explain better, there is some software that can help you create or modify textures. Some of this software, such as PixPlant (http://www.pixplant.com/), is young and still evolving.
A 2D texture is a two-dimensional array of image data, a regular JPG or PNG image. The individual data elements of a texture are called texels. In 3D graphics, we use the term texels instead of image pixels. Texels are represented in different formats such as gl.RGB
, gl.RGBA
, gl.LUMINANCE
, or gl.ALPHA
along with their data types. Rendering with 2D textures requires a texture coordinate, which is an index into the image. Texture coordinates for...