Graphics Reference
In-Depth Information
Source file.
TutorialDlg.cpp file in
the Source Files folder of
the D3D _ SimulateGravity
project.
void CTutorialDlg::OnTimer(UINT nIDEvent) {
theApp.GetModel(). UpdateSimulation (); // update the model state
m _ view.DrawGraphics();
// Draw the view that shows our model
}
Listing 5.19. CTutorialDlg::OnTimer() (Tutorial 5.3).
Timer event versus wall clock. We have programmed the timer event to trigger
every 25 msec. Unfortunately, due to the shared windowing environment, the
actual triggering period is only roughly 25 msec. For supporting real-time display,
updating user events, and so on, roughly 25 msec is sufficient (e.g., a
5msec
difference will not result in observable inconsistencies). However, for real-time
simulation,
±
5 msec is 20% of 25 msec and may potentially result in 20% error!
To ensure more reliable simulation results, we poll the system clock to compute
an accurate elapsed wall-clock time in between update simulations.
±
Tutorial 5.4. Multiple View/Controller Pairs
Tutorial 5.4.
Project Name:
D3D _ TwoViews
Library Support:
UWBGL _ MFC _ Lib1
UWBGL _ D3D _ Lib3
Goals. Demonstrate incorporating multiple view/controller pairs in our de-
velopment environment.
Approach. Continue working with Tutorial 5.3. With the same model
component, we will add an extra view/controller pair. Once again, with the
relatively simple application, we can focus on examining the extra support
that is required for the multiple view/controller pairs.
Application specification. With a user interaction identical to that of Tuto-
rial 5.3, we will add an additional small window to display the free-falling
circle.
Figure 5.9 is a screenshot of the free-falling circle from Tutorial 5.4. This tutorial
focuses on developing the support for multiple output draw areas in the main
application window. We know that each view/controller pair requires the support
of a UIWindow for drawing, and that each UIWindow is associated with a hardware
drawing buffer from the graphics API. This means that in order to support multiple
view/controller pairs, we must be able to create multiple hardware drawing buffers
from the graphics API.
Figure 5.9.
Tutorial 5.4.
Graphics API: The GraphicsSystem Class
Recall the graphics hardware context (GHC) and rendering context (RC) frame-
work we developed from Section 4.2. Figure 4.3 illustrates that it is possible to
 
Search WWH ::




Custom Search