Graphics Reference
In-Depth Information
4.1
Relationship between Graphics and GUI APIs
Our Source Code
We say, “Tutorial 3.1 is based on two distinct types of APIs: the GUI API and
the graphics API.” By “based on” we refer to the fact that Tutorial 3.1 calls the
functions and uses the utility classes provided by these two types of APIs. In
practice, this means that we must include the appropriate header files to compile
our source code, and we must include the appropriate library files to link our
program.
Figure 4.1 shows the relationships between our source code and the two types
of APIs. The fact that our source code sits on top of the graphics API and GUI
API boxes indicates that our source code depends on the functionality of these
two types of APIs. In our applications, we configured the graphics API to draw
through the GUI API window. In this way, as illustrated in Figure 4.1, the Graph-
ics API module rests on top of the GUI API module.
Figure 4.2 uses the simple scene from Tutorial 3.1 as an example to illus-
trate the functionality and responsibilities of the two APIs. A screenshot from
Tutorial 3.1 is shown on the right of Figure 4.2 with the three GUI elements: the
drawing area, the application window, and the button. From Chapter 2, we un-
derstand how to work with GUI API functions to create, initialize, and control
the GUI elements to interact with the user. In this chapter, we will examine how
the graphics API configures and initializes the graphics hardware and obtains a
reference to the drawing area for presenting rendered images. We will carry out
our examination with the familiar two-square scene from Tutorial 3.1. Before
we begin analyzing the programming code, let's first develop a framework for
understanding graphics APIs.
Graphics API
GUI API
Figure 4.1. Relationship
between our source code
and the Graphics and GUI
APIs.
Graphics
Hardw are
Configure/Initialize
and Draw Commands
Present rendered
image
Our Source Code
Drawing Area
Application Window
Button
Graphics API
GUI API
Create/Initialize to
Interact with users
Figure 4.2.
Relationship of APIs.
Search WWH ::




Custom Search