Here is GLTemplate, a sample Windows application that opens an OpenGL window and draws a colored triangle. You can use it to experiment with OpenGL calls. The methods you'll want to look at are OnDraw(), SetupGLParameters(), and SetupProjection() within the CGLTemplateView class.
The following is a list of the example programs found in the OpenGL Programming Guide (Addison-Wesley Publishing Company). The examples will probably not run unless you are on a Silicon Graphics workstation, but reading the code can still be useful (and you can copy the code into GLTemplate to try it out). These examples are from the first edition of the Guide, so they may not correspond exactly to the second edition.
You can also get a zipped copy of all these files.
Accumulation buffer anti-aliasing, example 10-4. accanti.c Same scene as accanti without anti-aliasing. accnot.c Same as accanti, but anti-aliasing with perspective, example 10-2. accpersp.c Yet another accumulation buffer anti-aliasing example. accum.c Calculates the field of view in the y direction. aim.c Simple 2D alpha blending, example 7-1. alpha.c Alpha blending in 3D, example 7-2. alpha3D.c Anti-aliased true color (RGBA) lines, example 7-3. anti.c Anti-aliased color index lines, example 7-4. antiindex.c Anti-aliased points in color index mode. antipindex.c Anti-aliased points in RGBA mode. antipoint.c Anti-aliased polygons (Reality Engines only), example 7-5. antipoly.c Simple 2D bezier curve, example 11-1. bezcurve.c Bezier surface, example 11-3. bezmesh.c Wire-frame version of bezmesh, example 11-2. bezsurf.c Texture maps a checkerboard onto two rectangles, example 9-1. checker.c Texture maps a repeated checkerboard onto two rectanges. checker2.c Same as checker2, but only repeats edge pixels, not whole pattern. chess.c Arbitrary clipping planes, example 3-5. clip.c Diffuse material example. colormat.c A cone. cone.c A stretched wireframe cube with perspective. cube.c One-dimensional NURBS curve. curve.c Fog used to make distant lines darker. depthcue.c Quadrics used to draw some disks. disk.c Accumulation buffer used to make distant objects blurry, example 10-5. dof.c Same scene as dof, but without blur. dofnot.c Double buffering of rotating square, example 1-3. double.c Draw bitmaps of "F" using glBitmap(), example 8-1. drawf.c Feedback buffer queues GL primatives and then prints them to stdout, example 12-7. feedback.c Teapots in the fog, example 7-6. fog.c Fog in color index mode, example 7-7. fogindex.c Draws text in a bitmapped font using glBitmap() and display lists, example 8-2. font.c Demonstrates lighting model. light.c Display lists are used to draw lines with different stipples. linelist.c Diffent types of stippled lines, example 2-1. lines.c Executes a display list to draw triangles, example 4-2. list.c Demonstrates glGenList() and glPushAttrib(). list2.c Lighting in color map mode. maplight.c Assortment of different materials shown, example 6-3. material.c Mipmaps used to draw a texture map with a different color for each bitmap size, example 9-2. mipmap.c Demonstrates modeling transformations, example 3-2. model.c Light source moves around an object, example 6-2. movelight.c NURBS (Non-uniform rational B-splines) surface shaped like a heart. nurbs.c Mouse and depth buffer are used to select objects, example 12-6. pickdepth.c Mouse is used to select lines. pickline.c Mouse is used to select a square. picksquare.c Demonstrates directional versus point lights. plane.c Composite modeling transformations used in drawing models (arrow keys move spheres). planet.c Like planet, but scene is oriented "up." planetup.c Demonstrates polygon stippling, example 2-2. polys.c Arrow keys move a wire-frame "arm," example 3-7. robot.c Color light source. sccolorlight.c Same scene as sccolorlight, but without colored light. scene.c Same scene as sccolorlight, but with blue ambient light. scenebamb.c Same scene as sccolorlight, but with flat shading. sceneflat.c Shows selection mode and name stack to detect wheter objects collide with viewing volume, example 12-2. select.c White rectangle on a black background, example 1-2. simple.c Gouraud shaded triangle, example 5-1. smooth.c Wire frame sphere using glTranslatef(). sphere.c Diamond stencil cuts out part of a scene, example 10-1. stencil.c Demonstrates a stroke (vector) font and display lists, example 4-8. stroke.c Nurbs surface as a symmetrical hill, example 11-5. surface.c One versus two sided lighting. tea.c Teapots with different ambient values. teaambient.c Several different materials shown on teapots teapots.c Texture mapped teapot with texture coordinates generated automatically, example 9-3. texgen.c Evaluators used to generate curved surface and texture corrdinates, example 11-4. texturesurf.c BROKEN! Curves trim away part of a NURBS surface, example 11-6. trim.c Like font, but draws X fonts. xfont.c
|problems or comments to firstname.lastname@example.org||Friday, 25-Sep-1998 14:29:34 PDT|