32. Introduction to OpenGL
Dated: 03-07-2025
As a software interface for graphics hardware, OpenGL
renders multidimensional objects into a frame buffer
.1 OpenGL
is industry-standard graphics software with which programmers can create high-quality still and animated three-dimensional color images.
Where Applicable
It is built for compatibility across hardware and operating systems, making it easy to port across different operating systems (i.e. Linux
and Windows
). It is designed for use by C
and C++
programmers.
It is introduced since \(1992\).
Developer Driven Advantages
Industry Standard
An independent consortium, the OpenGL Architecture Review Board
, guides the OpenGL
specification. With broad industry support, OpenGL
is the only truly open, vendor-neutral, multiplatform graphics standard.
Stable
Backward compatibility requirements ensure that existing applications do not become obsolete.
Reliable and Portable
All OpenGL
applications produce consistent visual display results on any OpenGL
API-compliant hardware, regardless of operating system or windowing system.
Evolving
Because of its thorough and forward-looking design, OpenGL
allows new hardware innovations to be accessible through the API via the OpenGL
extension mechanism. In this way, innovations appear in the API in a timely fashion, letting application developers and hardware vendors incorporate new features into their normal product release cycles.
Scalable
OpenGL
API-based applications can run on systems ranging from consumer electronics to PCs, workstations, and supercomputers. As a result, applications can scale to any class of machine that the developer chooses to target.
Easy to Use
OpenGL
is well structured with an intuitive design and logical commands. Efficient OpenGL
routines typically result in applications with fewer lines of code than those that make up programs generated using other graphics libraries or packages. In addition, OpenGL
drivers encapsulate information about the underlying hardware, freeing the application developer from having to design for specific hardware features.
Well Documented
Numerous books have been published about OpenGL
, and a great deal of sample code is readily available, making information about OpenGL
inexpensive and easy to obtain.
Simplifies Software Development, Speeds Time-to-market
From graphics primitives like point
and lines
to complex lighting
and texture mapped curved surfaces, OpenGL
provides functions
with different standard abiding bindings for languages like
C
C++
Java
Fortran
Ada
This increases the developer productivity, decreasing the time to markets.
Available Everywhere
OpenGL
runs on every major operating system
including
Mac OS
OS/2
UNIX
Windows 95
Windows 98
Windows 2000
Windows NT
Linux
OPENStep
BeOS
Architected for Flexibility and Differentiation
Using the OpenGL
extension mechanism, hardware developers can differentiate their products by developing extensions that allow software developers to access additional performance and technological innovations.
The following topics present a global view of how OpenGL works:
Primitives and Commands
Discusses
- Points
- Line segments
- Polygons
- Processing of commands
A vertex
defines a point
which is the endpoint of a line
or a corner of polygon
where two edges
meet. Each vertex
also has some data associated with it such as
vertex
coordinates
colors
normals
2texture coordinates
edge flags
Commands are always processed in the order in which they are received.
OpenGL
Graphic Control
Provides some graphics operations such as
Transformation matrices
3- Lighting equation coefficients
- Antialiasing methods
Pixel
4 update operators
However, it doesn't provide you means to describe or model a complex geometric object. OpenGL
is procedural rather than descriptive.
Execution Model
The client application can issue commands which are interpreted by OpenGL
(the server) which could possibly run on a different hardware. This makes OpenGL
network transparent.
A server maintains several OpenGL contexts
each of which is an encapsulated OpenGL state
. A client
can connect to any of these contexts
.
The window system:
- Determines which portions of the
frame buffer
1OpenGL
may access at any given time. - Communicates to
OpenGL
how those portions are structured.
Frame buffer
1 configuration is done outside of OpenGL
in conjunction with the window
system. OpenGL
initialization takes place when the window
system allocates a window
for OpenGL
rendering.
Basic OpenGL
Operation
Gives a high-level description of how OpenGL
processes data to produce a corresponding image in the frame buffer
.1
OpenGL
processing of data
source: learn.microsoft.com
Display List
Rather than having all commands proceed immediately through the pipeline, you can choose to accumulate some of them in a display list for processing later.
Evaluator
The evaluator stage of processing provides an efficient way to approximate curve and surface geometry by evaluating polynomial commands of input values.
Per-vertex Operations and Primitive Assembly
OpenGL
processes geometric primitives such as
points
line segments
polygons
all of which are described by vertices
.
Vertices
are transformed and lit, and primitives are clipped to the viewport in preparation for rasterization
.
Rasterization
The rasterization
stage produces a series of frame buffer addresses
and associated values using a two-dimensional description of a
point
line segment
polygon
Each fragment so produced is fed into the last stage, per fragment
operations.
Per Fragment Operations
These are the final operations performed on the data before it is stored as pixels
4 in the framebuffer
.1
Following pixel operations, the pixel data is either:
- Stored as
texture memory
, for use in therasterization
stage. - Rasterized, with the resulting fragments merged into the
framebuffer
1 just as if they were generated from geometric data.
OpenGL
Processing Pipeline
source: learn.microsoft.com
References
-
Read more about vector normals. ↩
-
Read more about transformation matrices. ↩