NeHe OpenGL lighting code missing!?

Started by
0 comments, last by Yann L 16 years, 3 months ago
Hello. I am studying NeHe's Lesson 2-5. There is no code for lights in those programs. A CS professor told me in the past that you must have lighting to see any colors. What's wrong? Thanks, --Supercow80
Advertisement
While requiring light to see is an obvious fact in the real physical world, this assumption is incorrect with computer graphics. All what the rendering process does, is to assign a colour to a set of pixels. At the lowest level, the rendering system itself has no notion of light and shadows. It's all just about pixel colours. If you assign the colour red, for example, your objects will be red.

Lighting is an additional feature you specifically have to build into your renderer. You have to tell the graphics card that a pixel must be dark when not lit or in shadow. Or that a pixel will be bright green when under the influence of a green spot light. On modern graphics cards, this is usually done by shaders.

As a side note, I would advise against using NeHe tutorials for learning OpenGL. Here is a post where I outlined some better alternatives to NeHe. You should also learn more about basic computer graphics theory (and so should your professor, it seems ;)

This topic is closed to new replies.

Advertisement