Next: 3 Basic OpenGL Operation Up: The OpenGL Graphics Interface Previous: 1 Introduction

2 OpenGL

OpenGL (``GL'' for ``Graphics Library'') provides advanced rendering features in either immediate mode or display list mode. While OpenGL is a relatively new standard, it is very similar in both its functionality and its interface to Silicon Graphics' IRIS GL, and there are many succesful 3D applications that currently use IRIS GL for their 3D rendering.

Like the graphics systems already discussed, OpenGL is a software interface to graphics hardware. The interface consists of a set of several hundred procedures and functions that allow a programmer to specify the objects and operations involved in producing high-quality graphical images, specifically color images of three-dimensional objects. Like PEX, OpenGL integrates 3D drawing into X, but can also be integrated into other window systems (e.g. Windows/NT) or can be used without a window system.

OpenGL draws primitives into a framebuffer subject to a number of selectable modes. Each primitive is a point, line segment, polygon, pixel rectangle, or bitmap. Each mode may be changed independently; the setting of one does not affect the settings of others (although many modes may interact to determine what eventually ends up in the framebuffer). Modes are set, primitives specified, and other OpenGL operations described by sending commands in the form of function or procedure calls.

Geometric primitives (points, line segments, and polygons) are defined by a group of one or more vertices. A vertex defines a point, an endpoint of an edge, or a corner of a polygon where two edges meet. Data (consisting of positional coordinates, colors, normals, and texture coordinates) are associated with a vertex and each vertex is processed independently, in order, and in the same way. The only exception to this rule is if the group of vertices must be clipped so that the indicated primitive fits within a specified region; in this case vertex data may be modified and new vertices created. The type of clipping depends on which primitive the group of vertices represents.

OpenGL provides direct control over the fundamental operations of 3D and 2D graphics. This includes specification of such parameters as transformation matrices, lighting equation coefficients, antialiasing methods, and pixel update operators. It does not provide a means for describing or modeling complex geometric objects. Another way to describe this situation is to say that OpenGL provides mechanisms to describe how complex geometric objects are to be rendered rather than mechanisms to describe the complex objects themselves.

The model for interpretation of OpenGL commands is client-server. That is, a program (the client) issues commands, and these commands are interpreted and processed by OpenGL (the server). The server may or may not operate on the same computer as the client.

The effects of OpenGL commands on the framebuffer are ultimately controlled by the window system that allocates framebuffer resources. It is the window system that determines which portions of the framebuffer that OpenGL may access at any given time and that communicates to OpenGL how those portions are structured. Similarly, display of framebuffer contents on a CRT monitor (including the transformation of individual framebuffer values by such techniques as gamma correction) is not addressed by OpenGL. Framebuffer configuration occurs outside of OpenGL in conjunction with the window system; the initialization of an OpenGL context occurs when the window system allocates a window for OpenGL rendering. Additionally, OpenGL has no facilities for obtaining user input, since it is expected that any window system under which OpenGL runs must already provide such facilities. These considerations make OpenGL independent of any particular window system.



Next: 3 Basic OpenGL Operation Up: The OpenGL Graphics Interface Previous: 1 Introduction


segal@asd.sgi.com
Fri Sep 23 16:08:14 PDT 1994