, cavosboig.site, Inc. or its affiliates This is the example code for the OpenGL Programming Guide (Red Book), 9th Edition. It is mostly an import of code. 1 Programming Guide (Redbook). Code Samples released by SGI with the OpenGL distribution in These are very useful for beginning OpenGL coding. DOes anyone know where I could download the opengl programming guide second edition (or maybe third edition) version or , in pdf.
- Code samples for the OpenGL v1.1 Programming Guide (Redbook)
- opengl red book 6th edition pdf
Advanced rendering and later extensions are not covered in these examples. This program 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. This program shows how to draw anti-aliased lines.
Use the accumulation buffer to do full-scene antialiasing on a scene with perspective projection, using the special routines accFrustum and accPerspective. 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. 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. This program renders a lighted, filled Bezier surface, using two-dimensional evaluators. This program texture maps a checkerboard image onto two rectangles.
This program clamps the texture, if the texture coordinates fall outside 0. After initialization, the program will be in ColorMaterial mode. Interaction: pressing the mouse buttons will change the diffuse reflection values. This program demonstrates a single modeling transformation, glScalef and a single viewing transformation, gluLookAt.
A wireframe box is rendered. 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.
This is a simple double buffered program. Pressing the left mouse button rotates the rectangle. Pressing the middle mouse button stops the rotation. Draws the bitmapped letter F on the screen several times. This demonstrates use of the glBitmap call. This program demonstrates use of OpenGL feedback. First, a lighting environment is set up and a few lines are drawn.
Then feedback mode is entered, and the same lines are drawn.
Code samples for the OpenGL v1.1 Programming Guide (Redbook)
The results in the feedback buffer are printed. This program draws 5 red teapots, each at a different z distance from the eye, in different types of fog. Pressing the left mouse button chooses between 3 types of fog: exponential, exponential squared, and linear.
In this program, there is a fixed density value, as well as fixed start and end values for the linear fog. This program demonstrates fog in color index mode. Three cones are drawn at different z values in a linear fog.
opengl red book 6th edition pdf
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. This program demonstrates the use of the OpenGL lighting model. A sphere is drawn using a grey material characteristic.
A single light source illuminates the object. This program demonstrates how to make and execute a display list.
Note that attributes, such as current color and matrix, are changed. 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 program demonstrates using mipmaps for texture maps. To overtly show the effect of mipmaps, each mipmap reduction level has a solidly colored, contrasting texture image. Thus, the quadrilateral which is drawn is drawn with several different colors. 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. 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.
Picking is demonstrated in this program. In rendering mode, three overlapping rectangles are drawn. When the left mouse button is pressed, selection mode is entered with the picking matrix.
Rectangles which are drawn under the cursor position are "picked. 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.
This program shows how to composite modeling transformations to draw translated and rotated models. Interaction: pressing the d and y keys day and year alters the rotation of the planet around the sun. This program demonstrates polygon offset to draw a shaded polygon and its wireframe counterpart without ugly visual artifacts "stitching".
Quadric objects are created with some quadric properties and the callback routine to handle errors. Note that the cylinder has no top or bottom and the circle has a hole in it.
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. Objects are drawn using a grey material characteristic.
This is an illustration of the selection mode and name stack, which detects whether objects which collide with a viewing volume. First, four triangles and a rectangular box representing a viewing volume are drawn drawScene routine. The green triangle and yellow triangles appear to lie within the viewing volume, but the red triangle appears to lie outside it. Then the selection mode is entered selectObjects routine. Drawing to the screen ceases. To see if any collisions occur, the four triangles are called.
In this example, the green triangle causes one hit with the name 1, and the yellow triangles cause one hit with the name 3. This program demonstrates smooth shading. A smooth shaded polygon is drawn in a 2-D projection. This program draws two rotated tori in a window. A diamond in the center of the window masks out part of the scene.
Within this mask, a different model a sphere is drawn in a different color. This program demonstrates some characters of a stroke vector font. The characters are represented by display lists, which are given numbers which correspond to the ASCII values of the characters. Use of glCallLists is demonstrated. This program demonstrates lots of material properties. 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. 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. This program demonstrates using glBindTexture by creating and managing two textures. This program draws a texture mapped teapot with automatically generated texture coordinates.
The texture is rendered as stripes on the teapot. Pressing the 'e' key changes the coordinate generation to eye coordinates of the vertex.