A surface represents a linear area of display memory. Surfaces usually reside in the display memory of the display card, although they can exist in system memory. They are managed by the Surface class.
Familiarity with the following terms is necessary to understand surfaces.
- front buffer. A rectangle of memory that is translated by the graphics adapter and displayed on the monitor. In Microsoft 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.
Getting a Surface
To create a surface, call any of the following methods.
Surface formats determine how data for each pixel in surface memory is interpreted. Direct3D uses the Format property of the SurfaceDescription structure to describe the surface format. The SurfaceDescription structure of an existing surface can be retrieved via its Surface.Description property.
Once a surface is created, a pointer to it can be obtained by calling any of the following methods.
The Surface class enables indirect access to memory through the UpdateSurface method. This method allows the copying of a rectangular region of pixels from one UpdateSurface class to another. The UpdateSurface class also has methods to directly access display memory. For example, the Surface.LockRectangle method can be used to lock a rectangular region of display memory. It is important to call Surface.UnlockRectangle after working with the locked rectangular region on the surface.
Additional Surface Topics
The following topics provide information about how to use surfaces.