IRenderTargetBackBufferUtilities

interface IRenderTargetBackBufferUtilities

This services provides utility methods for making render targets match the backbuffer.

RenderTarget2D UpdateRenderTarget(RenderTarget2D renderTarget, IRenderContext renderContext)

Given an existing (or null) render target, returns either the existing render target, or disposes the existing render target and creates a new one so that the returned render target matches the backbuffer.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The existing render target, which is either returned or disposed.
  • renderContext (Protogame.IRenderContext) – The current render context.
Returns:

A render target that matches the backbuffer.

RenderTarget2D UpdateCustomRenderTarget(RenderTarget2D renderTarget, IRenderContext renderContext, System.Nullable<SurfaceFormat> surfaceFormat, System.Nullable<DepthFormat> depthFormat, System.Nullable<Int32> multiSampleCount)

Given an existing (or null) render target, returns either the existing render target, or disposes the existing render target and creates a new one so that the returned render target matches the backbuffer size, with a custom surface format and no depth buffer.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The existing render target, which is either returned or disposed.
  • renderContext (Protogame.IRenderContext) – The current render context.
  • surfaceFormat (System.Nullable<SurfaceFormat>) – The surface format to use.
  • depthFormat (System.Nullable<DepthFormat>) –
  • multiSampleCount (System.Nullable<Int32>) –
Returns:

A render target that matches the backbuffer in size.

RenderTarget2D UpdateSizedRenderTarget(RenderTarget2D renderTarget, IRenderContext renderContext, Vector2 size)

Given an existing (or null) render target, returns either the existing render target, or disposes the existing render target and creates a new one so that the returned render target matches the specified size and backbuffer.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The existing render target, which is either returned or disposed.
  • renderContext (Protogame.IRenderContext) – The current render context.
  • size (Microsoft.Xna.Framework.Vector2) – The size of the render target.
Returns:

A render target that matches the backbuffer.

RenderTarget2D UpdateCustomSizedRenderTarget(RenderTarget2D renderTarget, IRenderContext renderContext, Vector2 size, System.Nullable<SurfaceFormat> surfaceFormat, System.Nullable<DepthFormat> depthFormat, System.Nullable<Int32> multiSampleCount, System.Nullable<Boolean> shared)

Given an existing (or null) render target, returns either the existing render target, or disposes the existing render target and creates a new one so that the returned render target matches the specified size, with a custom surface format and no depth buffer.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The existing render target, which is either returned or disposed.
  • renderContext (Protogame.IRenderContext) – The current render context.
  • size (Microsoft.Xna.Framework.Vector2) – The size of the render target.
  • surfaceFormat (System.Nullable<SurfaceFormat>) – The surface format to use.
  • depthFormat (System.Nullable<DepthFormat>) –
  • multiSampleCount (System.Nullable<Int32>) –
  • shared (System.Nullable<Boolean>) – If the render target should be shared.
Returns:

A render target that matches the backbuffer in size.

bool IsRenderTargetOutOfDate(RenderTarget2D renderTarget, IRenderContext renderContext)

Returns whether the specified render target matches the backbuffer.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The render target to check.
  • renderContext (Protogame.IRenderContext) – The current render context.
Returns:

Whether the specified render target matches the backbuffer.

bool IsSizedRenderTargetOutOfDate(RenderTarget2D renderTarget, IRenderContext renderContext, Vector2 size)

Returns whether the specified render target matches the backbuffer and size.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The render target to check.
  • renderContext (Protogame.IRenderContext) – The current render context.
  • size (Microsoft.Xna.Framework.Vector2) – The size of the render target.
Returns:

Whether the specified render target matches the backbuffer.

bool IsCustomRenderTargetOutOfDate(RenderTarget2D renderTarget, IRenderContext renderContext, System.Nullable<SurfaceFormat> surfaceFormat, System.Nullable<DepthFormat> depthFormat, System.Nullable<Int32> multiSampleCount)

Returns whether the specified custom render target matches the backbuffer size and specified surface format.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The render target to check.
  • renderContext (Protogame.IRenderContext) – The current render context.
  • surfaceFormat (System.Nullable<SurfaceFormat>) – The surface format to use.
  • depthFormat (System.Nullable<DepthFormat>) –
  • multiSampleCount (System.Nullable<Int32>) –
Returns:

Whether the specified render target matches the backbuffer size and specified surface format.

bool IsCustomSizedRenderTargetOutOfDate(RenderTarget2D renderTarget, IRenderContext renderContext, Vector2 size, System.Nullable<SurfaceFormat> surfaceFormat, System.Nullable<DepthFormat> depthFormat, System.Nullable<Int32> multiSampleCount)

Returns whether the specified custom render target matches the specified size and specified surface format.

Parameters:
  • renderTarget (Microsoft.Xna.Framework.Graphics.RenderTarget2D) – The render target to check.
  • renderContext (Protogame.IRenderContext) – The current render context.
  • size (Microsoft.Xna.Framework.Vector2) – The size of the render target.
  • surfaceFormat (System.Nullable<SurfaceFormat>) – The surface format to use.
  • depthFormat (System.Nullable<DepthFormat>) –
  • multiSampleCount (System.Nullable<Int32>) –
Returns:

Whether the specified render target matches the backbuffer size and specified surface format.