View Full Version : Hi, need openGl's lighting code

01-20-2010, 07:02 AM
Hi, I'm looking for openGL's lighting code.
If anyone can tell me how can I access the openGL source code it would be great.


01-20-2010, 07:48 AM
OpenGL is an open standard, not open source.

Mesa3D is an open source implementation of OpenGL, check it.

01-20-2010, 08:03 AM
Maybe you mean you need the lighting equations used in the fixed-pipeline. In this case, look at the spec 3.2 with compatibility profile, page 74 and 75:


Or, if the red font hurts your eyes, then just get the spec 2.1, pages 62 and 63:

Dark Photon
01-20-2010, 07:01 PM
The OpenGL Red Book (http://www.opengl.org/documentation/red_book/) is a really easy read, and in English. There's a whole chapter on Lighting. Once you've got the concepts and basic lighting algorithms in-mind, following lighting code in various GLSL lighting tutorials (google it) and Mesa3D (http://www.mesa3d.org) code should be a lot simpler.

Also, 3DLabs' ShaderGen (http://3dshaders.com/home/index.php?option=com_weblinks&catid=14&Itemid=34) tool will generate GLSL shaders for specific fixed-function pipeline permutations, including lighting. Might accelerate your task a bit.