Table of Contents

Class RenderTarget2D

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll
public class RenderTarget2D : Texture2D, IDisposable
Inheritance
RenderTarget2D
Implements
Inherited Members

Constructors

RenderTarget2D(GraphicsDevice, int, int)

public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height)

Parameters

graphicsDevice GraphicsDevice
width int
height int

RenderTarget2D(GraphicsDevice, int, int, bool, SurfaceFormat, DepthFormat)

public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)

Parameters

graphicsDevice GraphicsDevice
width int
height int
mipMap bool
preferredFormat SurfaceFormat
preferredDepthFormat DepthFormat

RenderTarget2D(GraphicsDevice, int, int, bool, SurfaceFormat, DepthFormat, int, RenderTargetUsage)

public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)

Parameters

graphicsDevice GraphicsDevice
width int
height int
mipMap bool
preferredFormat SurfaceFormat
preferredDepthFormat DepthFormat
preferredMultiSampleCount int
usage RenderTargetUsage

RenderTarget2D(GraphicsDevice, int, int, bool, SurfaceFormat, DepthFormat, int, RenderTargetUsage, SurfaceType)

Allows child class to specify the surface type, eg: a swap chain.

protected RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format, DepthFormat depthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, Texture2D.SurfaceType surfaceType)

Parameters

graphicsDevice GraphicsDevice
width int
height int
mipMap bool
format SurfaceFormat
depthFormat DepthFormat
preferredMultiSampleCount int
usage RenderTargetUsage
surfaceType Texture2D.SurfaceType

RenderTarget2D(GraphicsDevice, int, int, bool, SurfaceFormat, DepthFormat, int, RenderTargetUsage, bool)

public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, bool shared)

Parameters

graphicsDevice GraphicsDevice
width int
height int
mipMap bool
preferredFormat SurfaceFormat
preferredDepthFormat DepthFormat
preferredMultiSampleCount int
usage RenderTargetUsage
shared bool

RenderTarget2D(GraphicsDevice, int, int, bool, SurfaceFormat, DepthFormat, int, RenderTargetUsage, bool, int)

public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, bool shared, int arraySize)

Parameters

graphicsDevice GraphicsDevice
width int
height int
mipMap bool
preferredFormat SurfaceFormat
preferredDepthFormat DepthFormat
preferredMultiSampleCount int
usage RenderTargetUsage
shared bool
arraySize int

Properties

DepthStencilFormat

public DepthFormat DepthStencilFormat { get; }

Property Value

DepthFormat

IsContentLost

public bool IsContentLost { get; }

Property Value

bool

MultiSampleCount

public int MultiSampleCount { get; }

Property Value

int

RenderTargetUsage

Gets the usage mode of the render target.

public RenderTargetUsage RenderTargetUsage { get; }

Property Value

RenderTargetUsage

The usage mode of the render target.

Methods

Dispose(bool)

The method that derived classes should override to implement disposing of managed and native resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

True if managed objects should be disposed.

Remarks

Native resources should always be released regardless of the value of the disposing parameter.

GraphicsDeviceResetting()

Called before the device is reset. Allows graphics resources to invalidate their state so they can be recreated after the device reset. Warning: This may be called after a call to Dispose() up until the resource is garbage collected.

protected override void GraphicsDeviceResetting()

QuerySelectedFormat(GraphicsDevice, SurfaceFormat)

protected static SurfaceFormat QuerySelectedFormat(GraphicsDevice graphicsDevice, SurfaceFormat preferredFormat)

Parameters

graphicsDevice GraphicsDevice
preferredFormat SurfaceFormat

Returns

SurfaceFormat

Events

ContentLost

public event EventHandler<EventArgs> ContentLost

Event Type

EventHandler<EventArgs>