QT OpenGL RedBook Examples

This program draws shows how to draw anti-aliased lines in color index mode. It draws two diagonal lines to form an X; when 'r' is typed in the window, the lines are rotated in opposite directions.

* QT translation of aaindex.

This program draws several overlapping filled polygons to demonstrate the effect order has on alpha blending results. Use the 't' key to toggle the order of drawing polygons.

* QT translation of alpha.

This program demonstrates how to intermix opaque and alpha blended polygons in the same scene, by using glDepthMask. Press the 'a' key to animate moving the transparent object through the opaque object. Press the 'r' key to reset the scene.

* QT translation of alpha3d.

This program uses evaluators to draw a Bezier curve.

* QT translation of bezcurve.

This program renders a lighted, filled Bezier surface, using two-dimensional evaluators.

* QT translation of bezmesh.

This program renders a wireframe Bezier surface, using two-dimensional evaluators.

* QT translation of bezsurf.

This program texture maps a checkerboard image onto two rectangles. This program clamps the texture, if the texture coordinates fall outside 0.0 and 1.0.

* QT translation of checker.

This program demonstrates arbitrary clipping planes.

* QT translation of clip.

This program shows an interactive program that uses glColorMaterial() to change material parameters. Pressing each of the three mouse buttons changes the diffuse reflection values.

* QT translation of colormat.

This example draws a wireframe cube that is scaled by a modeling transformation. The viewing transformation, gluLookAt(), positions and aims the camera towards where the cube is drawn. A projection transformation and a viewport transformation are also specified.

* QT translation of cube.

This program demonstrates use of the accumulation buffer to create an out-of-focus depth-of-field effect. The teapots are drawn several times into the accumulation buffer. The viewing volume is jittered, except at the focal point, where the viewing volume is at the same position, each time. In this case, the gold teapot remains in focus.

* QT translation of dof.
* QT translation of header file for dof.

Draws the bitmapped letter F on the screen (several times). This demonstrates use of the glBitmap() call.

* QT translation of drawf.

This program demonstrates drawing pixels and shows the effect of glDrawPixels(), glCopyPixels(), and glPixelZoom(). Interaction: moving the mouse while pressing the mouse button will copy the image in the lower-left corner of the window to the mouse position, using the current pixel zoom factors. There is no attempt to prevent you from drawing over the original image. If you press the 'r' key, the original image and zoom factors are reset. If you press the 'z' or 'Z' keys, you change the zoom factors.

* QT translation of image.

This example illustrates the results of drawing with a couple of different stipple patterns and line widths. It also illustrates what happens if the lines are drawn as a series of individual segments instead of a single connected line strip. It demonstrates geometric primitives and their attributes.

* QT translation of lines.

This program demonstrates the use of the GL lighting model. Several objects are drawn using different material characteristics. A single light source illuminates the objects. This example shows twelve spheres each with different material properties.

* QT translation of material.

This program demonstrates when to issue lighting and transformation commands to render a model with a light which is moved by a modeling transformation (rotate or translate). The light position is reset after the modeling transformation is called. The eye position does not change. A sphere is drawn using a grey material characteristic. A single light source illuminates the object. Interaction: pressing the left mouse button alters the modeling transformation (x rotation) by 30 degrees. The scene is then redrawn with the light in a new position.

* QT translation of movelight.

Use of multiple names and picking are demonstrated. A 3x3 grid of squares is drawn. When the left mouse button is pressed, all squares under the cursor position have their color changed.

* QT translation of picksquare.

Use of multiple names and picking are demonstrated. A 3x3 grid of squares is drawn. When the left mouse button is pressed, all squares under the cursor position have their color changed.

* QT translation of planet.

This program shows how to composite modeling transformations to draw translated and rotated hierarchical models. Interaction: pressing the s and e keys (shoulder and elbow) alters the rotation of the robot arm.

* QT translation of robot.

This program demonstrates polygon tessellation. Two tesselated objects are drawn. The first is a rectangle with a triangular hole. The second is a smooth shaded, self-intersecting star. Note the exterior rectangle is drawn with its vertices in counter-clockwise order, but its interior clockwise. Note the combineCallback is needed for the self-intersecting star. Also note that removing the TessProperty for the star will make the interior unshaded (WINDING_ODD).

* QT translation of tess.

This program demonstrates the winding rule polygon tessellation property. Four tessellated objects are drawn, each with very different contours. When the w key is pressed, the objects are drawn with a different winding rule.

* QT translation of tesswind.

This program demonstrates the creation of a display list.

* QT translation of torus.