File: README

package info (click to toggle)
lightlab 0.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 620 kB
  • ctags: 246
  • sloc: sh: 2,554; ansic: 1,843; makefile: 163
file content (65 lines) | stat: -rw-r--r-- 2,550 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

                              Light Lab

             a hybrid GTK/OpenGL program for experimenting
                    with the OpenGL lighting model.

                           by Jamie Zawinski

                      http://www.jwz.org/lightlab/


     This program lets you set the colors and positions of three
     GTK light sources, and watch the effect that has on a simple
     3D scene.

     Here is a quick overview of OpenGL lighting concepts.  If
     this isn't enough for you, check the man pages, or get a book
     on OpenGL, such as the one mentioned below.

       - Lights have three colors associated with them, and so do
         objects.  The color of a surface in a scene is determined
         by the combination of the colors of the surface and the
         colors of the lights shining on it.

       - Ambient lighting:

         Light so scattered it can be considered to come from
         every direction equally.  If a light in the scene has
         ambient light set, then a uniform, non-positional light
         of that color will hit all objects.

       - Diffuse lighting:

         Directional lighting that will reflect from surfaces
         according to their normal vectors.  Ambient light hitting
         a surface directly will be brigher than ambient light
         hitting at an angle.

       - Specular lighting:

         Like diffuse lighting, but the light shines back in a
         particular direction, depending on the Shininess of the
         surface.  The more shiny the surface, the more focused a
         specular reflection.

     The X, Y, and Z positions of each light are divided by the
     "W" value (in this program, called "Divisor") to get the
     actual position.  If the divisor is 0, then the distance is
     infinite, and the XYZ coordinate defines a vector pointing at
     an infinitely far light whose intensity does not decrease
     with distance (e.g., the sun.)

     If the divisor is non-zero, then it specifies the distance of
     the light from the origin along the XYZ vector.


     This program was inspired by a like-named GLUT program by
     Mark J. Kilgard.  His program allowed one to turn lights on
     and off, and set the color of objects as a demo of how
     lighting works, but did not allow one to experiment with
     specific light positions colors.  So, I wrote my own.

     For learning OpenGL programming, I highly recommend Mark's book,
     "OpenGL Programming for the X Window System", Addison-Wesley 1996,
     ISBN 0-201-48359-9.