Chapter 25. Windows graphics

In this chapter we talk about Windows graphics. The cGraphicsMFC implements Windows graphics using standard methods that are in the Windows GDI. The good thing about the GDI graphics methods is that you can be sure they'll work on any Windows machine, no matter what libraries are installed and no matter what kind of graphics card it has.

A limitation of the cGraphicsMFC class is that we haven't bothered to implement three-dimensional methods for it, so if you want to show three-dimensional graphics you need to use cGraphicsOpenGL (or, should it become available, cGraphicsDirectX ).

It would be nice to simply say that you should always use cGraphicsMFC for two-dimensional games and cGraphicsOpenGL for three-dimensional games. But on certain graphics cards, the cGraphicsOpenGL calls will actually run faster than the cGraphicsMFC calls. The Pop Framework leaves the choice up to the user , with controls to select one or the other kind of graphics.

Windows graphics can be made to run quite fast, thanks to double-buffering. In this chapter we'll discuss the basics of fast Windows graphics, and then we'll describe how the Pop Framework implements double-buffering for Windows graphics with a cMemoryDC , which is a memory-based device context.

Software Engineering and Computer Games
Software Engineering and Computer Games
Year: 2002
Pages: 272 © 2008-2017.
If you may any questions please contact us: