Game Development Reference
In-Depth Information
m_DeviceContext.Draw(36, 0);
As you can see, we've changed it to draw 36 vertices now. This is because our cube
has 36 vertices. But a cube only has eight corners, right? Well, each corner vertex
is duplicated for each side it is shared by. You can avoid this somewhat by using the
TriangleStrip primitive topology rather than TriangleList as we've used here
and by using index buffers as discussed earlier in this chapter.
As always, don't forget to edit the Dispose(bool) method, and make sure it dis-
poses of all of our disposable objects. The following are some examples of the pro-
gram running in all three of our graphics modes:
The cube demo in all three graphics modes
The first part of the previous diagram shows the program when you set
m_GraphicsMode to GraphicsMode.SolidBlue . The second image shows
GraphicsMode.PerVertexColoring , and the last image shows Graphic-
sMode.Textured .
Search WWH ::




Custom Search