Graphics Reference
In-Depth Information
tation of the scene from Figure 3.1 based on the OpenGL API. As we will
see, all of our knowledge will apply in a straightforward manner.
Associate semantic meanings to the program source code. This map-
ping of source code blocks allows us to design abstractions for the simple
scene. In this way, we can achieve easier-to-comprehend source code with
modular design and support for maintenance, modification, expansion, and
reuse. We will explore this in Tutorial 3.3.
Understand the core of a simple graphics program. We have sufficient
knowledge to modify the scene and predict results. For example, we can
imagine adding more squares, or even other geometric shapes. Notice that,
without much knowledge of any API technologies, we can achieve a degree
of understanding that allows us to modify the scene. We will explore this
in Tutorial 3.5.
3.4
Further Examples
Tutorial 3.2. Drawing Squares with MFC and OpenGL
Tutorial 3.2.
Project Name
OGL _ Rectangles2D
Goal. Verify that the concepts of rendering procedure learned from Tuto-
rial 3.1 are API-independent.
Approach. Examine an OpenGL implementation of Figure 3.1 and apply
our knowledge from Tutorial 3.1 in understanding the source code.
Figure 3.7 is a screenshot of running Tutorial 3.2. As we can see, this program
has the same front-end GUI layout as Tutorial 3.1 with exactly the same behavior
where the program draws the scene from Figure 3.4 and quits when the user clicks
on the button. However, unlike Tutorial 3.1, the computer graphics functionality
of Tutorial 3.2 is based on the OpenGL API.
The back-end development source code structure of Tutorial 3.2 is similar
to that of Tutorial 3.1. The only difference is that, instead of a D3D draw-
ing area ( CGrfxWndD3D ), Tutorial 3.2 has an OpenGL drawing area defined by
the CGrfxWndOGL class in the GrfxWindowOGL.h/.cpp files. Corresponding
to the same GUI layout on the main application windows, the CTutorialDlg
classes of Tutorials 3.1 and 3.2 are also very similar. Once again, the only differ-
ence is a CGrfxWndOGL control variable for drawing with OpenGL instead of the
CGrfxWndD3D object. At this point, we can predict that the drawing routine for
OpenGL should be located in CGrfxWndOGL::OnPaint() function.
Figure 3.7.
Tutorial 3.2.
 
Search WWH ::




Custom Search