Search Cool Links


Computer Reviews
Animated Tutorials
Windows Help and Tips
PC Support

The Super 7 Hardware Guide to OpenGL

What is OpenGL?

OpenGL (short for Open Graphics Library) is a software system that allows programmers to manipulate graphics hardware. This software system interface consists of a set of hundreds of procedures and functions that allow a programmer to cite the objects and operations involved in producing high-quality graphical images, specifically color images of 3D objects.

OpenGL requires that the graphics hardware contain a framebuffer. Which is typically the DRAM on your graphics card. Many OpenGL calls relate to drawing objects such as points, lines, polygons, and bitmaps, but the way that some of this drawing occurs (such as when anti-aliasing or texturing is enabled) depends on the existence of a framebuffer. And some of OpenGL is specifically concerned with framebuffer manipulation.

To the programmer, OpenGL is a set of commands that allow the individualization of geometric objects in two or three dimensions, together with the commands that control how these objects are rendered into video memory. For the most part, OpenGL provides an immediate-mode interface, meaning that specifying an object causes it to be drawn.

Typically, programs that uses OpenGL begin with calls to open a window into the framebuffer into which the program will draw. Then, calls are made to allocate a GL context and associate it with the window. Once a GL context is allocated, the programmer is free to issue OpenGL commands. Some calls are used to draw simple geometric objects (i.e. points, line segments, and polygons), while others affect the rendering of these primitives (simple objects), including how they are lit or colored and how they are mapped from the user's 2D or 3D model space to the 2D monitor screen. There are also calls to effect direct control of the framebuffer, such as reading and writing pixels.

To the program designer, OpenGL is a set of commands that control the operation of graphics hardware. If the hardware consists only of an addressable framebuffer, then OpenGL commands are calculated almost entirely by the host CPU. But since today’s graphics hardware consist of varying degrees of graphics acceleration, from a simple 2D raster subsystem capable of rendering two-dimensional lines and polygons to sophisticated floating-point 3D engines capable of transforming and computing on geometric data. The OpenGL program designer’s task is to provide the CPU a software interface while allocating the work for each OpenGL command between the CPU and the graphics hardware. This division must be tailored to the available graphics hardware to obtain optimal performance. This is why some games allow you to specify the graphics engine used by your graphics card.

OpenGL manages a considerable amount of state information. This state controls how objects are drawn into video memory. Some of this state is directly available to the user: he or she can make calls to obtain its value. Some of it, however, is visible only by the effect it has on what is drawn.

OpenGL is concerned only with rendering to and reading values from the framebuffer, and does not support other peripherals sometimes associated with graphics hardware, such as mice and keyboards. Programmers must rely on other mechanisms to obtain user input.

OpenGL draws simple objects to a number of selectable modes. Each object is a point, line segment, polygon, or pixel rectangle. Modes 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 video memory). Modes are set, objects specified, and sending commands in the form of function or procedure calls creates other OpenGL operations.

OpenGL provides direct control over the fundamental operations of 3D and 2D graphics. This includes specification of such parameters as transformation matrices, lighting effects, antialiasing methods, and pixel update operators. It does not provide a means for describing or modeling complex geometric objects. In other words OpenGL provides the mechanics 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 client program 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. In this sense, OpenGL is network-transparent. A server may maintain any number of context states, each of which compartmentalizes the current GL state. A client may choose to connect to any one of these contexts. Issuing OpenGL commands when the program is not connected to a context results in undefined behavior.

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 OpenGL may access at any given time and that communicates how those portions are structured. Framebuffer configuration occurs outside of OpenGL in conjunction with the window system; the initialization of OpenGL context occurs when the window system allocates a window for GL rendering.

Because OpenGL is based on ideal behavior rather than absolute behavior it can be run on a range of graphics platforms with varying graphics capabilities and performance. In cases where deviation from the ideal is allowed, OpenGL specifies the rules that must be obeyed if it is to approximate the ideal behavior usefully. This allowed variation in OpenGL behavior implies that two distinct implementations may be identical pixel for pixel when presented with the same input even when run on identical framebuffer configurations.


MediaTek All Rights Reserved