To create a Direct3D 11 device in C#, you can use the following code:
main.cs326 chars16 lines
This code creates a Device
object, which represents the Direct3D 11 device. The DeviceCreationFlags
parameter specifies any special flags to use when creating the device. In this case, we're adding the Debug
flag if we're running in a debug build, which enables additional error and warning messages.
The featureLevels
parameter specifies the Direct3D feature levels to try when creating the device. The levels are attempted in order, with the highest level first. Level_11_1
is the highest feature level supported by Direct3D 11, and Level_11_0
is the next highest.
The CreateDevice
method creates the Device
object, and returns it in the out
parameter. If the method is successful, device
will contain a valid Direct3D 11 device that you can use to render graphics.
gistlibby LogSnag