Chapter 1: Graphics Systems and Models
This is a course in computer graphics, by which term we mean the use of computer programs to construct pictures or images on a computer screen. This course focuses on OpenGL, which is a standard for developing graphics applications. Fortunately, OpenGL is widely available and easily learned.
We must immediately state that the course is not about the use of existing tools, such as Microsoft Excel or PowerPoint to create graphical displays. These topics are important and deserve study, but do not fit within the focus of this course.
This course assumes a fairly good knowledge of the C++ programming language as a prerequisite. A considerable amount of the course is devoted to writing C++ code that uses OpenGL facilities to create graphic images. It is conjectured that OpenGL can be called from Visual Basic. If this is true, students will be allowed to write the graphics programs in Visual Basic. The instructor cannot determine whether or not this is possible.
The Function of an API (Application Programmer’s Interface)
OpenGL provides a standard API; that is, a standard set of methods and properties to be used in the construction of graphical images. Any computer system supporting the OpenGL standard must provide implementations of these methods and properties. To understand the purpose of an API, consider the following block diagram of a graphics system.
The purpose of a graphics system is to display graphics images on some type of display device. This display device is controlled by hardware that is specifically designed to match the device. There may be a number of hardware controllers for a specific display, each with characteristics, such as graphics memory and specialty buffers, that improve performance.
The device dependent hardware is controlled by the device dependent software, often called a device driver, designed to present the hardware/display combination to the computer system in a device independent way. The device dependent software presents a standard interface to the user software that is intended to hide the details of the software/hardware implementation of the graphics functions. This interface is often called the API. OpenGL is one standard API for graphics programming. In the opinion of this author, it is one of the most important.
Any standard graphics API must provide for both user input and graphical output. Devices for user input include the keyboard, the mouse, a light pen, and often other devices. Output devices include video displays and plotters (such as Calcomp) that plot on paper. We shall cover specific input devices when we have occasion to mention the methods associated.
Three Dimensional Graphics
All graphical o
Consider a cube being viewed from a distance. Imagine we are looking at one side only and
are at such a distance that we cannot see the other sides. We might think that we are looking at a
square, which is a two dimensional o
One feature that is important in graphical display systems,
especially CAD (Computer Aided Design), is the ability to view the o
The Synthetic Camera Model
We need a logical model in order to consider graphical display systems. We base our model on the similarity of a high-quality graphical display to a picture taken by a camera; indeed a picture taken by a digital camera is exactly a graphical display in the computer sense.
We call this logical model the synthetic
camera model. In such a model, we
have a single camera looking at a physical o
Another feature of the model is the assumption that light travels in straight lines. This illustrates an important feature of most models – the model does not have to be correct, but only to make predictions and allow calculation of useful results. In fact, light does not always travel in straight lines. There are a number of experiments, called “single slit” and “multiple slit” in which light behaves in very strange ways. However, at the level of our interest, light acts as if it travels in straight lines. More specifically, the assumption that light travels in straight lines allows us to create images that are extremely realistic. For this reason we use the model and call it “true”.
At this point, we should make a comment on the coordinate systems used and how they relate to what actually happens in a real camera.
One feature of a bellows camera that makes it useful for discussion of graphics systems is the construction with a glass plate at the back. One can look at the back of the camera and see an image as it will appear on film when the film plate is placed in the back of the camera.
If one examines the image of a
building on the glass screen at the back of the camera, he will find it to be
upside-down; technically it has been rotated 180 degrees. This is a feature of the lens system of the
camera. Normally we do not carry the
camera analogy to such an extreme. If we
discuss the image of a physical o
The term clipping refers
to the fact that a graphical display does not usually show the complete scene
of a physical o
A pinhole camera is a camera made by taking an opaque box, placing film on one of the inside surfaces, and piercing the center of the opposite side of the box with a push pin. With some experimentation, it is possible to use such a device to take pictures. The main difficulty is that the pin hole admits very little light (in photography terms it has a high “F Number”), so that long exposures are required to get a picture. Other characteristics of this camera, such as its large depth of focus, are best discussed in a photography class.
We present the pinhole camera
as a method to introduce the discussion of logical (image) coordinates and
their dependence on world coordinates – those coordinates used to describe the
In our study of the pinhole
camera, it is convenient to place the pinhole at the origin of the coordinate
system; i.e., at (0, 0, 0), which denotes X = 0, Y = 0, and Z = 0. We point the camera along the positive Z-axis
so that an o
(0, 0, 1). More on vectors later.
We present a side view of the camera, technically a slice in the (Y, Z) plane.
In this diagram, we have a
point at coordinates (X, Y, Z) being imaged.
The image of the point is placed on the film at coordinates (x, y, z),
z = – d, because the image is on the film at z = – d. Suppose that Y > 0. Then we see that y < 0, and use similar triangles to obtain
(– y) / d = Y / Z or
y = – Y · ( d / Z) = – Y / ( Z / d). We use similar arguments for x.
We use some simple trigonometry to determine the field of view of the camera.
We compute the field of view Q of the camera by using trig functions to compute the half angle F. The reason for computing the half angle is that it is part of a right triangle, for which we can apply the standard methods of trigonometry.
By inspection we see that tan(F) =
(h/2) / d, so
F = tan-1 (h / 2·d) and Q = 2 · tan-1 (h / 2·d).