Direct3D Surfaces

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.

Getting a Surface

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 IDirect3DSurface9::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 IDirect3DDevice9::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 IDirect3DSurface9::LockRect method to lock a rectangular region of display memory. It is important to call IDirect3DSurface9::UnlockRect after you are done working with the locked rectangular region on the surface.

Additional Surface Topics

Find out more about how to use surfaces with any of these topics: