Chapter 4. Color

Chapter Objectives

After reading this chapter, you’ll be able to do the following:

• Decide between using RGBA or color-index mode for your application

• Specify desired colors for drawing objects

• Use smooth shading to draw a single polygon with more than one color

Note

In OpenGL Version 3.1, many of the techniques and functions described in this chapter were removed through deprecation. In particular, color-index rendering is not supported. The concepts relating to RGBA color modes are still relevant, but need to be implemented in vertex or fragment shaders, as described in Chapter 15.

The goal of almost all OpenGL applications is to draw color pictures in a window on the screen. The window is a rectangular array ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Versions 3.0 and 3.1, Seventh Edition 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.