Graphics Reference
In-Depth Information
8. In the same source file, replace the Main() function with the following code to
initialize our Direct3D device and swap chain.
[STAThread]
static void Main()
{
#region Direct3D Initialization
// Create the window to render to
Form1 form = new Form1();
form.Text = "D3DRendering - EmptyProject";
form.Width = 640;
form.Height = 480;
// Declare the device and swapChain vars
Device device;
SwapChain swapChain;
// Create the device and swapchain
Device.CreateWithSwapChain(
SharpDX.Direct3D.DriverType.Hardware,
DeviceCreationFlags.None,
new [] {
SharpDX.Direct3D.FeatureLevel.Level_11_1,
SharpDX.Direct3D.FeatureLevel.Level_11_0,
SharpDX.Direct3D.FeatureLevel.Level_10_1,
SharpDX.Direct3D.FeatureLevel.Level_10_0,
},
new SwapChainDescription()
{
ModeDescription =
new ModeDescription(
form.ClientSize.Width,
form.ClientSize.Height,
new Rational(60, 1),
Format.R8G8B8A8_UNorm
),
SampleDescription = new SampleDescription(1,0),
Usage = SharpDX.DXGI.Usage.BackBuffer | Usage.
RenderTargetOutput,
BufferCount = 1,
Flags = SwapChainFlags.None,
IsWindowed = true,
 
Search WWH ::




Custom Search