Let there be light!

Until this point, we haven't worried about lighting. In fact, we just assumed that light would be there so that we could see our images. OpenGL has a light setting that lights everything equally. This setting is turned on, by default, until we tell OpenGL that we would like to handle the lighting.

Imagine what our scene would look like if there was no lighting. In fact, this is going to happen to you some day. You will have everything set up and ready to roll, you'll run the program, and you'll get a big, black, nothing! What's wrong? You forgot to turn on the lights! Just as shown in the following image:

Let there be light!

Just like real life, if ...

Get OpenGL Game Development By Example 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.