SwapChain Class (Microsoft.DirectX.Direct3D)
How Do I...?
- Create an Additional Swap Chain
Manipulates a swap chain.
Definition
Visual Basic NotInheritable Public Class SwapChain
Inherits MarshalByRefObject
Implements IDisposableC# public sealed class SwapChain : MarshalByRefObject, IDisposable C++ public ref class SwapChain sealed : MarshalByRefObject, IDisposable JScript public final class SwapChain extends MarshalByRefObject implements IDisposable
Members Table
The following table lists the members exposed by the object.
Events
Event Description Disposing Occurs when the Dispose method is called or when the SwapChain object is finalized and collected by the garbage collector of the .NET common language runtime. Methods
Method Description Dispose Immediately releases the unmanaged resources used by the SwapChain object. Equals Returns a value that indicates whether the current instance is equal to a specified object. Finalize Allows the SwapChain object to free resources before it is destroyed by the garbage collector. GetBackBuffer Retrieves a back buffer from the swap chain of a device. GetFrontBufferData Generates a copy of the swap chain's front buffer and places it in a Surface object provided by the application. GetHashCode Returns the hash code for the current instance. GetObjectByValue This member supports the infrastructure for DirectX 9.0 for Managed Code and is not intended to be used directly from your code. op_Equality Compares the current instance of a class to another instance to determine whether they are the same. op_Inequality Compares the current instance of a class to another instance to determine whether they are different. Present Presents the contents of the next buffer in the sequence of back buffers owned by the swap chain. raise_Disposing Raises the Microsoft.DirectX.Direct3D.SwapChain.Disposing event when called from within a derived class. SwapChain Creates a new instance of the SwapChain class. UpdateUnmanagedPointer Updates the unmanaged pointer for this SwapChain object. This method supports the Microsoft .NET Framework infrastructure and is not intended to be used directly in your code. Properties
Property Description Device Retrieves the device associated with a swap chain. DisplayMode Retrieves the display mode's spatial resolution, color resolution, and refresh frequency. Disposed Gets a value that indicates whether the object is disposed. PresentParameters Retrieves the presentation parameters associated with a swap chain. RasterStatus Returns information that describes the raster of the monitor on which the swap chain is presented. UnmanagedComPointer Returns the unmanaged Component Object Model (COM) IDirect3DSwapChain9 interface pointer.
Inheritance Hierarchy
SwapChain
Remarks
Each device always has at least one swap chain, which is known as the implicit swap chain. Additional SwapChain objects can be created for rendering multiple views from the same device.
How Do I...?
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:
- 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.
- 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.
[C#] // Create a swap chain using an existing instance of PresentParameters. SwapChain sc = new SwapChain(device, presentParams);
Class Information
Namespace Microsoft.DirectX.Direct3D Assembly Microsoft.DirectX.Direct3D (microsoft.directx.direct3d.dll) Strong Name Microsoft.DirectX.Direct3D, Version=1.0.900.0, Culture=neutral, PublicKeyToken=d3231b57b74a1492