PDA

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



tali9
01-20-2010, 08: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.

thanks,
tal

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

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

overlay
01-20-2010, 09: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:

http://www.opengl.org/registry/doc/glspec32.compatibility.20091207.pdf

Or, if the red font hurts your eyes, then just get the spec 2.1, pages 62 and 63:
http://www.opengl.org/registry/doc/glspec21.20061201.pdf

Dark Photon
01-20-2010, 08: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.