Table of Contents

Class RenderTargetGraphicsPresenter

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

A simple GraphicsPresenter wrapping a Render-Target Texture where drawing will occur but no actual presentation will happen.

public class RenderTargetGraphicsPresenter : GraphicsPresenter, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
object
RenderTargetGraphicsPresenter
Implements
Inherited Members
Extension Methods

Remarks

This class is useful when configuring an application that will be rendering to a Texture instead of the screen.

Constructors

RenderTargetGraphicsPresenter(GraphicsDevice, Texture, PixelFormat)

Initializes a new instance of the RenderTargetGraphicsPresenter class.

public RenderTargetGraphicsPresenter(GraphicsDevice device, Texture renderTarget, PixelFormat depthFormat = PixelFormat.None)

Parameters

device GraphicsDevice

The Graphics Device.

renderTarget Texture

A two-dimensional Texture that serves as a Render Target to draw into.

depthFormat PixelFormat

The format of the Depth-Stencil buffer

Properties

BackBuffer

Gets the default Back-Buffer for the Graphics Presenter.

public override Texture BackBuffer { get; }

Property Value

Texture

The Texture where rendering will happen, which will then be presented to the front-buffer.

IsFullScreen

Gets or sets a value indicating if the Graphics Presenter is in full-screen mode.

public override bool IsFullScreen { get; set; }

Property Value

bool

A RenderTargetGraphicsPresenter always returns true for this property, and this value cannot be modified.

NativePresenter

Gets the underlying native presenter.

public override object NativePresenter { get; }

Property Value

object

The native presenter. Depending on platform, for exmaple, it can be a Silk.NET.DXGI.IDXGISwapChain or Silk.NET.DXGI.IDXGISwapChain1 or null.

Methods

Present()

Presents the Back-Buffer to the screen.

public override void Present()

Remarks

A RenderTargetGraphicsPresenter does nothing for this method; it wraps an internal Render-Target Texture to draw to, and not a swap-chain buffer.

ResizeBackBuffer(int, int, PixelFormat)

Resizes the Back-Buffer.

protected override void ResizeBackBuffer(int width, int height, PixelFormat format)

Parameters

width int

The new width of the Back-Buffer, in pixels.

height int

The new height of the Back-Buffer, in pixels.

format PixelFormat

The new pixel format for the Back-Buffer.

Remarks

When implementing this method, the derived class should resize the Back-Buffer to the specified size and format.

Exceptions

NotSupportedException

The specified pixel format or size is not supported by the Graphics Device.

ResizeDepthStencilBuffer(int, int, PixelFormat)

Resizes the Depth-Stencil Buffer.

protected override void ResizeDepthStencilBuffer(int width, int height, PixelFormat format)

Parameters

width int

The new width of the Depth-Stencil Buffer, in pixels.

height int

The new height of the Depth-Stencil Buffer, in pixels.

format PixelFormat

The new pixel format for the Depth-Stencil Buffer.

Remarks

When implementing this method, the derived class should resize the Depth-Stencil Buffer to the specified size and format.

Exceptions

NotSupportedException

The specified depth format or size is not supported by the Graphics Device.

SetBackBuffer(Texture)

Sets the Back-Buffer where the frame must be rendered.

public void SetBackBuffer(Texture backBuffer)

Parameters

backBuffer Texture

The Render Target to use as Back-Buffer.