Graphics Reference
In-Depth Information
In this chapter, we describe the principles of working with modern GUI APIs.
We emphasize principles because we are going to rely heavily on the MFC API to
illustrate the ideas presented. However, it is important to remember that our focus
is not learning the skills of using any particular API. Instead, we are interested
in understanding the basic capabilities of modern GUI APIs so that we can ex-
amine and implement the requirements of event-driven interactive programs. For
example, we should be able to apply the lessons learned from this chapter to other
GUI APIs (e.g., the Java Swing Library or the Microsoft Forms Library). After
this chapter (and with some practice), we want to be able to pick up the reference
manual of any modern GUI API and commence developing a simple interactive
application.
The ultimate goal of this chapter is the understanding of GUI APIs' support
for user interactivity and not the implementation of the ball-shooting program. A
proper implementation of the ball-shooting program can only commence after we
learn the software architecture for organizing our solution structure, which will
be covered in Chapter 5.
2.1
Our Application and Existing Libraries
Graphical UI. Notice that the
“graphical” in GUI refers to a
user interface that is “graphi-
cally” oriented. For example,
a user interface with visually
pleasing “graphical” buttons
or slider bars. This should not
be confused with the “com-
puter graphics” we are learn-
ing in this topic.
When developing interactive computer graphics programs, we work with exist-
ing tools, or software libraries, to develop our applications. In this topic, we
are learning how to develop user interactive graphics applications, and thus we
work with graphical user interface (GUI) libraries and graphics libraries. These
libraries provide well-defined application programming interfaces (APIs) with
well-documented functions and utility classes. The applications we develop use/-
subclass from the utility classes and call appropriate functions through the APIs.
In this way, our application interacts with the users through a GUI API and draws
graphics through a graphics API.
Examples of popular GUI APIs include Graphics Utility Toolkit (GLUT), Fast
and Light Toolkit (FLTK), and Microsoft Foundation Classes (MFC). Examples
of popular graphics APIs include OpenGL API, Microsoft Direct X Direct3D
(D3D), and Java 3D. In this topic, we will work with MFC to interact with the
user, and OpenGL and D3D to draw graphics. We show examples in more than
one GUI API to demonstrate that although the utility classes and function names
may be significantly different, the principles of working with GUI APIs are very
similar. We show examples in more than one graphics API to demonstrate that
although configuration procedures are different, and the functions have very dif-
ferent names, these APIs are designed based on the same fundamental graphics
Search WWH ::




Custom Search