Game Development Reference
_manager.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer,
The following method was included in this topic for completeness, though it does
not directly deal with the swap chain manager. This method recalculates the pro-
jection matrix after the render target client region is resized.
private void CalculateProjection()
if (this.Height == 0)
float aspect = (float)this.Width / this.Height;
_manager.Device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4,
The example provided on the Companion Web site is an MDI application that
uses the swap chain manager described in this topic to render into multiple child
windows and multiple controls within a child window. You can see two different
types of child windows using the swap chain manager in Figure 25.1, and one of
the child windows is maximized in Figure 25.2.
Both the sphere and teapot meshes are loaded into the single Direct3D device and
are shared across all child windows in the example.