Direct3D Surfaces (Direct3D 9)
A surface represents a linear area of display memory and usually resides in the display memory of the display card, although surfaces can exist in system memory. Surfaces are managed by the IDirect3DSurface9 interface.
- Front Buffer. A rectangle of memory that is translated by the graphics adapter and displayed on the monitor. In Direct3D an application never writes directly to the front buffer.
- Back Buffer. A rectangle of memory that an application can directly write to. The back buffer is never directly displayed on the monitor.
- Flipping surfaces. The process of moving the back buffer to the front buffer.
- Swap chain. A collection of one or more back buffers that can be serially presented to the front buffer.
Create a surface by calling any of these methods:
Surface formats determine how data for each pixel in surface memory is interpreted. Direct3D uses the D3DFORMAT member of the D3DSURFACE_DESC structure to describe the surface format. You can retrieve the format of an existing surface by calling the GetDesc method.
Once a surface is created, you can get a pointer to it by calling any of these methods:
The IDirect3DSurface9 interface enables you to indirectly access memory through the UpdateSurface method. This method allows you to copy a rectangular region of pixels from one IDirect3DSurface9 interface to another IDirect3DSurface9 interface. The surface interface also has methods to directly access display memory. For example, you can use the LockRect method to lock a rectangular region of display memory. It is important to call UnlockRect after you are done working with the locked rectangular region on the surface.
Find out more about how to use surfaces with any of these topics:
- Surface Formats (Direct3D 9)
- What Is a Swap Chain? (Direct3D 9)
- Width vs. Pitch (Direct3D 9)
- Flipping Surfaces (Direct3D 9)
- Page Flipping and Back Buffering (Direct3D 9)
- Copying to Surfaces (Direct3D 9)
- Copying Surfaces (Direct3D 9)
- Accessing Surface Memory Directly (Direct3D 9)
- Private Surface Data (Direct3D 9)
- Gamma Controls (Direct3D 9)