Chapter 9. Colors, Materials, and Lights

 

Some people are always grumbling because roses have thorns; I am thankful that thorns have roses.

 
 --Alphonse Karr

One of the basic tenets of creating a good scene is that you have to make it look interesting. There’s no better way to achieve this than to make good use of lighting and textures. This chapter will cover the basics of creating and using color, materials, textures, and lighting in your OpenGL programs.

Color

OpenGL supports two color models. The first is RGBA mode, where you select the value for each of the red, blue, green, and alpha (or opacity) parameters. The second is color-index mode, whereby you fill a palette with the colors that you’ll need in your program. Palette programming is one ...

Get OpenGL Programming for Windows 95 and Windows NT 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.