Creating a Device


Note: All rendering devices created by a given Microsoft Direct3D object share the same physical resources. Although your application can create multiple rendering devices from a single Direct3D object, because they share the same hardware, extreme performance penalties will be incurred.

To create a Direct3D device, your managed code application should first create a PresentParameters object that contains the presentation parameters for the device. The following C# code example contains a simple initialization using the Device(Int32,DeviceType,Control,CreateFlags,PresentParameters[]) constructor that receives a PresentParameters object.

          [C#]
          
using Microsoft.DirectX.Direct3D; . . . // Global variables for this project Device device = null; // Create rendering device PresentParameters presentParams = new PresentParameters(); device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);

This call also specifies the default adapter, a hardware device, and software vertex processing.

Note that a call to create, dispose, or reset the device should happen only on the same thread as the window procedure of the focus window. After creating the device, set its state.

Related Topics


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center