Chapter 3 -- Setting Up DirectDraw for a Direct3D Program

[Previous] [Next]

Chapter 3

DirectDraw is a Microsoft DirectX API that lets you directly control display-device features such as the following:

  • The primary surface, which is the memory that represents what you see on your screen
  • Off-screen surfaces, which store images that can be transferred to the visible display area (includes texture maps in 3D programs)
  • Hardware overlay support, which allows the display of a 2D image that is shown "in front of" the display without disturbing the contents of the primary surface
  • Depth buffers, which are used to store depth information when rendering a 3D scene
  • The hardware blitter, which is used for blitting, the process of copying 2D data from one location to another
  • Flipping-surface support (page flipping), which is used to switch between one or more rendered views in memory (back buffers) and the main, visible display surface to keep the screen from tearing (described later in the chapter) or otherwise flickering from frame to frame
  • Stereo support, in which one image is shown to the left eye and a different image is shown to the right eye
  • Clipping for windowed or full-screen programs

Overall, DirectDraw provides a device-independent approach for accessing display devices and is the DirectX API used for all 2D drawing operations. It is also the foundation for Direct3D, so even "3D-only" programs need to use DirectDraw.

DirectDraw manages all the objects it creates and tracks the resources that have (or haven't) been allocated. It also handles the following features:

  • The default color key, which is used to create transparent areas as blue screening in movies does
  • The hardware display mode, which is the resolution, color depth, and refresh rate the system is using
  • The default palette (the set of colors available) if the primary surface is in 8-bits-per-pixel mode

DirectDraw allows you to enumerate the capabilities of the underlying hardware and use the supported hardware-accelerated features.

DirectDraw works with many types of display hardware, including standard SVGA monitors; head-mounted displays; and new, more advanced systems capable of handling clipping, color formats other than RGB, and stretching. Like the other DirectX APIs, DirectDraw is designed to emulate any feature the host system's hardware doesn't provide, when possible.

DirectDraw and Direct3D enumerate the hardware capabilities of any target platform to determine which support hardware acceleration of various features. You should write your software to require only those abilities necessary for the program to execute efficiently but to check for and use any other capabilities if they are available. For example, only newer hardware supports single-pass multitexturing, so requiring this feature in your application would lock out users who have older systems; on the other hand, users who have the latest and greatest hardware will expect the games they buy to include support for such advanced features.



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