Class RenderTargetGraphicsPresenter
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
-
objectRenderTargetGraphicsPresenter
- 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
deviceGraphicsDeviceThe Graphics Device.
renderTargetTextureA two-dimensional Texture that serves as a Render Target to draw into.
depthFormatPixelFormatThe format of the Depth-Stencil buffer
Properties
BackBuffer
Gets the default Back-Buffer for the Graphics Presenter.
public override Texture BackBuffer { get; }
Property Value
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
widthintThe new width of the Back-Buffer, in pixels.
heightintThe new height of the Back-Buffer, in pixels.
formatPixelFormatThe 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
formator 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
widthintThe new width of the Depth-Stencil Buffer, in pixels.
heightintThe new height of the Depth-Stencil Buffer, in pixels.
formatPixelFormatThe 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
formator 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
backBufferTextureThe Render Target to use as Back-Buffer.