⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opengl redbook samples.htm

📁 openGL programming guid---the redbook,介绍openGL C++编程
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0053)http://www.opengl.org/resources/code/samples/redbook/ -->
<HTML><HEAD><TITLE>OpenGL Redbook Samples</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY>
<H2>Code samples for the OpenGL v1.1 Programming Guide (Redbook)</H2>
<P>Code Samples released by SGI with the OpenGL 1.1 distribution in 1997. These 
are very useful for beginning OpenGL coding and learning OpenGL program 
structure. Advanced rendering and later extensions are not covered in these 
examples. </P>
<P><A 
href="http://www.opengl.org/resources/code/samples/redbook.zip"><B>Download All 
Sample Code as a single Zip file</B></A></P>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/aaindex.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/aaindex.c">aaindex.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/aargb.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>This program shows how to draw anti-aliased lines. It draws two 
      diagonal lines to form an X; when 'r' is typed in the window, the lines 
      are rotated in opposite directions.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/aargb.c">aargb.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/accanti.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>A simple example of using accumulation buffer to anti-alias.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/accanti.c">accanti.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/accpersp.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>Use the accumulation buffer to do full-scene antialiasing on a scene 
      with perspective projection, using the special routines accFrustum() and 
      accPerspective().</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/accpersp.c">accpersp.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/alpha.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/alpha.c">alpha.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/alpha3D.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/alpha3D.c">alpha3D.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/bezcurve.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>This program uses evaluators to draw a Bezier curve.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/bezcurve.c">bezcurve.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/bezmesh.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>This program renders a lighted, filled Bezier surface, using 
      two-dimensional evaluators.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/bezmesh.c">bezmesh.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/bezsurf.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>This program renders a wireframe Bezier surface, using two-dimensional 
      evaluators.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/bezsurf.c">bezsurf.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/checker.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/checker.c">checker.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/clip.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>This program demonstrates arbitrary clipping planes.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/clip.c">clip.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/colormat.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>After initialization, the program will be in ColorMaterial mode. 
      Interaction: pressing the mouse buttons will change the diffuse reflection 
      values.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/colormat.c">colormat.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/cube.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>This program demonstrates a single modeling transformation, glScalef() 
      and a single viewing transformation, gluLookAt(). A wireframe box is 
      rendered.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/cube.c">cube.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/dof.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/dof.c">dof.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/double.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>This is a simple double buffered program. Pressing the left mouse 
      button rotates the rectangle. Pressing the middle mouse button stops the 
      rotation.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/double.c">double.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/drawf.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>Draws the bitmapped letter F on the screen (several times). This 
      demonstrates use of the glBitmap() call.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/drawf.c">drawf.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/feedback.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>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. The results in the feedback buffer 
      are printed.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/feedback.c">feedback.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/fog.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/fog.c">fog.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/fogindex.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>This program demonstrates fog in color index mode. Three cones are 
      drawn at different z values in a linear fog. 32 contiguous colors (from 16 
      to 47) are loaded with a color ramp.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/fogindex.c">fogindex.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/hello.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>This is a simple, introductory OpenGL program.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/hello.c">hello.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/image.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/image.c">image.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/light.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/light.c">light.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/lines.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>This program demonstrates geometric primitives and their 
attributes.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/lines.c">lines.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/list.jpg" 
    width=256></TD>
    <TD vAlign=center>
      <P>This program demonstrates how to make and execute a display list. Note 
      that attributes, such as current color and matrix, are changed.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/list.c">list.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/material.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/material.c">material.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/mipmap.jpg" 
      width=256></TD>
    <TD vAlign=center>
      <P>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.</P>
      <P>Source code: <A 
      href="http://www.opengl.org/resources/code/samples/redbook/mipmap.c">mipmap.c</A>.</P></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=6 border=0>
  <TBODY>
  <TR>
    <TD><IMG height=256 src="OpenGL Redbook Samples.files/model.jpg" 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -