Game Development Reference
In-Depth Information
features or new stuff that Direct3D 11 brings to the table. Just make sure you
change all objects from the Direct3D 11 namespace to their counterparts in the
Direct3D 10 namespace.
You may notice that there is also Direct3D 11.1. We are not using this because it
is the Windows 8 version of Direct3D 11, and you can only use it on Windows 8.
So what is multisampling and anti-aliasing ? Anti-aliasing is actually an effect of
multisampling, where the jagged edges of objects are smoothed, so they don't look
jagged on the screen anymore. This jaggedness is caused by the fact that the pixels
on the screen are not infinitely small, and thus you can sometimes see a stair-step
pattern on the edges of objects on the screen. Multisampling involves looking at the
colors of adjacent pixels and blending them together in some fashion so as to soften
edges on the screen and remove other graphical artifacts that can be caused by ali-
asing, such as moiré patterns. You can look up for moiré patterns on Wikipedia: ht-
tp://en.wikipedia.org/wiki/Moir%C3%A9_pattern .
The next property we set on the SwapChainDescription object is the Flags
property. This property lets us set various flags that affect the behavior of our swap
chain. In this case, we set it to the SwapChainFlags.AllowModeSwitch flag,
which allows us to switch the screen mode of our swap chain by calling its Res-
izeTarget() method.
And the final property we are setting on our SwapChainDescription object is
the SwapEffect property. This sets options for how to handle the back buffer's
contents after it has been displayed on the screen. We have set this to SwapEf-
fect.Discard . And with that, we are done setting up our SwapChainDescrip-
tion object.
We are now ready to create our swap chain and the Direct3D device. Both of
these are accomplished with the next line of code, which calls a static member
of the SlimDX.Direct3D11.Device class; that method is the
CreateWithSwapChain() method. As you can see, there are six parameters.
The first parameter specifies the driver type. In this case, we set it to Driver-
Type.Hardware , since we want hardware acceleration if it is available. The second
parameter is the device creation flag. In this case, we have used
Search WWH ::




Custom Search