Game Development Reference
In-Depth Information
_manager.BeginSwapChainRender(_swapChain);
_manager.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer,
unchecked((int)-8454144),
1.0F,
0);
_manager.Device.BeginScene();
_manager.SphereMesh.DrawSubset(0);
_manager.Device.EndScene();
_manager.EndSwapChainRender(_swapChain);
}
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)
return;
float aspect = (float)this.Width / this.Height;
_manager.Device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4,
aspect,
1.0f,
60.0f);
}
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.
Search Nedrilad ::




Custom Search