Diffuse Light

Imagine a lamp lighting a large room. Much of the light bounces off many surfaces before reaching a viewer. While the light actually came from the lamp, it seems simply to be everywhere. This is the ambient portion of the light. Obviously, however, some of the light proceeds directly from the source to the surface of some object in the room and reflects directly to the viewer. However, unless the surface is a mirror, the light tends to scatter rather than bounce off at a predictable angle. In...

Specular Light Definition

The third component of light from a light source is specular light. Ambient light has been scattered from many surfaces and seems to come from all directions. Diffuse light comes from a specific direction the source, of course , but scatters from surfaces, giving a soft, flat appearance to surfaces. Ambient and Diffuse components of a light source commonly share the same color. Specular light is also directional, but much tighter in reflection than diffuse light, often with a different color....

Cube

Now you are ready for another illustration. For the sake of this illustration, comment out the glEnable GL_DEPTH_TEST statement you just put in. The new project name certainly suggests the next shape under discussion. A cube provides a fairly simple figure for introducing 3-D. In geometry a cube has identical height, width, and depth. Unfortunately the projection of such a figure onto the computer screen may not look like a cube unless the view port is square. Since the current view port...

Additional Considerations

You may have noticed by now that all the OpenGL command names begin with gl. The graphics library has a well-defined naming convention, which this book mentions from time to time. So far the gl prefix has dominated, which does apply to all OpenGL commands. A glu prefix has also made a cameo appearance. It is the standard for all commands of the utility library. Chapter 1 presented the wgl prefix for the extensions to Microsoft Windows that support OpenGL rendering. Similarly the X Window System...

Identifier Reference

An OpenGL command that causes material properties to track the current color set by glColor. It takes two parameters. The first tells which face or faces will be affected. The second tells which properties will track the current color. You must enable color tracking for this to work. An OpenGL command that defines characteristics of an OpenGL light source. You must enable lighting and enable the specific light. An OpenGL command that provides a simplified method of setting up a lighting...

Scale

With the Menu Designer add still another main menu item, amp Scale. Produce the following event handler in the same manner as before procedure TForm1.Scale1Click Sender TObject begin glMatrixMode GL_MODELVIEW glScalef xvalue,yvalue,zvalue Invalidate end The only new command has the following declarations procedure glScaled x,y,z GLdouble stdcall procedure glScalef x,y,z GLfloat stdcall The scale command multiplies the size of the objects in the scene. The value given for the x parameter...

Orthographic Projection Meaning

The call to glOrtho defines a clipping volume, which is a region in space in which objects can be seen. Any part of a scene that lies outside of the region is not visible clipped . Of course, though the rendered scenes may be conceptually three-dimensional, they must be projected onto a two-dimensional screen. The available projections are orthographic projection and perspective projection. You get one guess as to which kind glOrtho uses. In orthographic projection, also known as parallel...