Sign in to follow this  
supercow80

NeHe OpenGL lighting code missing!?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this