GraphicsDevice.Present Method (Nullable<Rectangle>, Nullable<Rectangle>, IntPtr)
Specifies the window target for a presentation and presents the display with the contents of the next buffer in the sequence of back buffers owned by the GraphicsDevice.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public void Present (
Nullable<Rectangle> sourceRectangle,
Nullable<Rectangle> destinationRectangle,
IntPtr overrideWindowHandle
)
Parameters
- sourceRectangle
The source rectangle. If null, the entire source surface is presented. If the rectangle exceeds the source surface, the rectangle is clipped to the source surface. This parameter must be null unless the swap chain was created with SwapEffect.Copy. - destinationRectangle
The destination rectangle, in window client coordinates. If null, the entire client area is filled. If the rectangle exceeds the destination client area, the rectangle is clipped to the destination client area. This parameter must be null unless the swap chain was created with SwapEffect.Copy. - overrideWindowHandle
Destination window containing the client area that is the target for this presentation. If not specified, this is DeviceWindowHandle.
Exceptions
Exception type | Condition |
---|---|
ObjectDisposedException | Present was called after the GraphicsDevice was disposed. |
DriverInternalErrorException | Internal driver error. Applications should generally shut down when receiving this error. |
DeviceLostException | The GraphicsDevice is lost but cannot be reset at this time. Therefore, rendering is not possible. |
Remarks
Warning
On Xbox 360, all render targets (including the back buffer) share the same memory. Because of this, the previous content of any render target is lost when the render target is changed with SetRenderTarget or when Present is called, which has the same effect as swapping the render target.
To preserve the data in a render target, it is necessary to resolve it, either with ResolveRenderTarget or ResolveBackBuffer. Just remember to resolve the render target before switching the render target to avoid losing data that you want to preserve.
See Also
Reference
GraphicsDevice Class
GraphicsDevice Members
Microsoft.Xna.Framework.Graphics Namespace
Platforms
Xbox 360, Windows XP SP2, Windows Vista