Setting Up DirectDraw

[Previous] [Next]

Now that you've had a quick overview of DirectDraw, let's get to the meat of the chapter: setting up DirectDraw for our Direct3D Immediate Mode program. (Although this chapter focuses mainly on DirectDraw, you'll see some Direct3D enumeration code here because a 3D program needs to get some Direct3D information before completely initializing DirectDraw.) This process involves the following steps:

  1. Create a structure to hold the Direct3D devices we enumerate.
  2. Enumerate all the available DirectDraw devices installed on the system; then perform steps 3 through 5 on each DirectDraw device:
  3. Create a DirectDraw object.
  4. Enumerate the display modes.
  5. Enumerate the Direct3D devices.
  6. Pick a display device and a Direct3D device.
  7. Initialize DirectDraw, which includes setting the cooperative level, creating the front and back buffers, and attaching a clipper.

In the following sections, I'll describe each step and explain how to implement it. We'll be looking at some code from the Direct3D framework, which does all these steps. d3denum.cpp contains the code to do steps 1-6, and d3dframe.cpp contains the code to do step 7. Code in d3dapp.cpp directs the whole process by calling into code in these other two files. By the end of the chapter, you'll see how to create the foundation of a Direct3D application. You can reuse this code for all your future Direct3D applications, so make sure you remember this sequence of steps and the basic tasks involved.



Inside Direct3D
Inside Direct3D (Dv-Mps Inside)
ISBN: 0735606137
EAN: 2147483647
Year: 1999
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net