GLLT.EXE Demonstrates Simple Lighting in OpenGL (152001)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • Microsoft Windows NT Server 4.0
    • Microsoft Windows NT Workstation 4.0
    • Microsoft Windows 98
    • Microsoft Windows 95
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional

This article was previously published under Q152001

SUMMARY

The GLLight sample provides a demonstration of how the various light settings effect an OpenGL scene. The initial scene is simply a single white sphere with a single blue light (GL_LIGHT0) shining on it.

You can modify all of the properties of that light as well as the light model characteristics for the scene to observe the visual effect. GLLight does not use multiple lights and does not allow you to change the material properties of the sphere.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
GLLight allows you to experiment with all of the OpenGL lighting capabilities for a single-light scene quickly and easily. These characteristics fall into the following categories seen in the "Settings" dialog box:
   Characteristics of the Light Source (GL_LIGHT0):

     Position
     Intensity (ambient, diffuse, specular)
     Spotlight Properties (exponent, cutoff)
     Attenuation (constant, linear, quadratic)

   Characteristics of the Lighting Model:

     Global ambient light
     Viewpoint (local or infinite)
     Lighting (one-sided or two-sided)
				
The initial settings for these characteristics follow the defaults for GL_LIGHT0 with two exceptions: the Position is moved back so as to light the sphere; and the Diffuse Intensity is set to blue.

The material properties of the sphere are left as defaults except for a white Specular reflectance and a medium Shininess setting. You cannot modify the material properties through the UI in this sample.

To demonstrate the effects of one-sided vs. two-sided lighting, there is an option to place a clipping plane through the sphere in order to uncover the inside of it. To see the difference between the inside and outside more clearly, you should move the light some distance along the x or y axes.

REFERENCES

For more information on the above settings and OpenGL in general, please read:

-Neider, Jackie, Tom Davis, and Mason Woo. OpenGL Programming Guide: The Official Guide to Learning OpenGL, Release 1. Reading, MA: Addison-Wesley, ISBN 0-201-63274-8. (This book is also known as the "Red Book".)

For information on Material Properties in OpenGL, please see: The GLBMP Sample "Demonstration of OpenGL Material Property and Printing" in the Microsoft Download Center, and the "Red Book" mentioned above.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbFAQ kbfile kbgraphic kbinfo KB152001 kbAudDeveloper