O'Reilly logo

OpenGL ES 3.0 Cookbook by Parminder Singh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Applying texture with UV mapping

A texture is basically an image represented by a chunk of memory in the computer; this memory contains color information in the form of red (R), green (G), blue (B), and alpha (A) component; each component is represented as a series of bits/bytes, depending on the format of the type of texture.

In this recipe, we will create a simple square and apply texture to it; three things are required for texture mapping:

  1. An image first needs to be loaded into the OpenGL ES texture memory with the help of texture objects.
  2. A texture is mapped to the geometry using texture coordinates.
  3. Use texture coordinates to get the corresponding color from texture in order to apply it on the surface of the geometry.

Getting ready

The GLPI

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required