13.016 Introduction to Geometric Modeling and Computation


OpenGL

OpenGL is an API (or Application Programming Interface) for producing high-quality 2D and 3D graphic images, including such advanced features as hidden surface removal, texture mapping, transparency, and motion blur. OpenGL is independent of display hardware, operating system, and window system.

Although originally developed by Silicon Graphics, Inc. (SGI), OpenGL is now under the control of the independent Architecture Review Board, including members from DEC, Evans & Sutherland, IBM, Intel, Integraph, Microsoft, and SGI.

OpenGL implementations are available for SGI, DEC Alpha, HP Freedeom, IBM RS/6000, Intergraph TD Series, and Sun workstations. Also, it is available for Microsoft Windows 95 and Windows NT.

Languge bindings are available for C++, C, and Fortran. (Unfortunately, the current Fortran binding does not work!)

Example

Just to provide the flavor of OpenGL, the following example program draws a white square centered in a black window:

#include <GL/gl.h>
#include <GL/glu.h>

main()
{
  /* open the window here ... */

  glClearColor(0.0, 0.0, 0.0, 0.0);   /* set clear color to black */
  glClear(GL_COLOR_BUFFER_BIT);       /* erase window to black */

  gluOrtho2d(-1.0, 1.0, -1.0, 1.0);   /* 2d orthographic projection */

  glColor3f(1.0, 1.0, 1.0);           /* set drawing color to white */

  glBegin(GL_POLYGON);                /* start a new polygon */
  glVertex2f(-0.5, -0.5);             /* vertices of polygon ... */
  glVertex2f(-0.5,  0.5);
  glVertex2f( 0.5,  0.5);
  glVertex2f( 0.5, -0.5);
  glEnd();                            /* end of polygon */

  glFlush();                          /* actually draw on screen */

  /* keep the window on the screen */
}

On to geometric primitives...
Back to graphics software...
Back to the overview...