Chapter 4. Using Textures

In this chapter, we will cover:

  • Applying a 2D texture
  • Applying multiple textures
  • Using alpha maps to discard pixels
  • Using normal maps
  • Simulating reflection with cube maps
  • Simulating refraction with cube maps
  • Applying a projected texture
  • Rendering to a texture
  • Using sampler objects

Introduction

Textures are an important and fundamental aspect of real-time rendering in general, and OpenGL in particular. The use of textures within a shader opens up a huge range of possibilities. Beyond just using textures as sources of color information, they can be used for things like depth information, shading parameters, displacement maps, normal vectors, or other vertex data. The list is virtually endless. Textures are among the most widely used ...

Get OpenGL – Build high performance graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.