RenderTarget RenderTarget { get; set; }

robot_2Generated
code_blocksInput

Description

The RenderTarget property in the Sandbox.Graphics class allows you to get or set the current render target. When you set this property, it binds the specified render target and adjusts the viewport to match the dimensions of the render target. This is crucial for rendering operations where you need to direct the output to a specific target, such as a texture or a frame buffer, rather than the default screen output.

Usage

To use the RenderTarget property, simply assign it a RenderTarget object. This will automatically bind the render target and adjust the viewport accordingly. You can also retrieve the current render target by accessing this property.

Example

// Example of setting a render target
RenderTarget myRenderTarget = new RenderTarget();
Graphics.RenderTarget = myRenderTarget;

// Example of getting the current render target
RenderTarget currentRenderTarget = Graphics.RenderTarget;