Create an Additional Swap Chain

This example demonstrates how to create an additional swap chain using the SwapChain class. Additional swap chains are useful for supporting multiple viewports; for example, a single window partitioned into four sub-windows, each with different views of the same scene.

In Microsoft DirectX 9.0 for Managed Code, each Device is created with a default swap chain known as the implicit swap chain. Using the SwapChain class allows creation of additional swap chains for rendering operations.

To create a new swap chain:

  1. Create an instance of the PresentParameters class, or use an existing instance and set the presentation properties to the values you need for the swap chain.
  2. Then create a swap chain object using the SwapChain class constructor.

In the following C# code example, device is assumed to be the rendering Device.

    // Create a swap chain using an existing instance of PresentParameters.
    SwapChain sc = new SwapChain(device, presentParams);