Game Development Reference
In-Depth Information
whether we want to start the program in windowed mode. Remember that we haven't
implemented fullscreen mode yet.
Next, we have the ModeDescription property, which specifies the video mode
we want to use. The first two parameters of the ModeDescription object are the
height and width. In other words, they are the screen resolution we want to use.
The third parameter is the refresh rate specified as a numerator and a denominat-
or. Here, we have it set to the fraction 60/1 , which means a refresh rate of 60 times
per second. And lastly, we have the format parameter. This tells it the pixel format,
and as you can see, we have it set to Format.R8G8B8A8_UNorm . This means we
have eight bits for each of the four color channels (red, green, blue, and alpha). The
UNorm part of this format name indicates that the values of the color channels are
unsigned, normalized integers (normalized meaning they are in the range 0.0 - 1.0 ).
An unsigned integer is similar to a normal integer variable, except that it does
not support negative numbers. This allows an unsigned integer to hold much larger
values than you can store in a normal integer variable of the same size. The oppos-
ite of an unsigned integer is a signed integer variable, which has to use half of its
possible values to represent negative numbers.
The next property we set on the SwapChainDescription object is the
SampleDescription property. For this, we create a new sample description object
and give it two parameters: the first parameter is the number of multisamples per
pixel, and the second parameter is the quality level. The valid range for the qual-
ity level is 0 to one less than the level returned by the CheckMultisampleQual-
ityLevel() method of the Direct3D device object (remember that the device is
stored in our m_Device member variable). Of course, higher quality levels are more
expensive to perform than lower ones. Here, we set the count to 1 and quality to
0 . This is the default sampler state with no anti-aliasing. Note that there are also a
couple of standard values we can use to set our multisampling level, and they are
defined in the Direct3D11.StandardMultisamplQualityLevel enumeration.
Note
If your PC is not able to use Direct3D 11, you can change the code in this chapter
to use Direct3D 10 instead. The code should be nearly identical, since Direct3D
11 is in reality an extension of Direct3D 10, and we are not using any advanced
Search WWH ::




Custom Search