Texture RenderTarget { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The RenderTarget property of the CameraComponent class specifies the texture to which the camera will render its output. This property is essential when you want to render the camera's view to a texture instead of directly to the screen. To use this property, you must create a render target texture using the Texture.CreateRenderTarget method.

Usage

To use the RenderTarget property, you need to assign a texture that has been created as a render target. This is typically done when you want to perform off-screen rendering or render the camera's view to a texture for further processing or display elsewhere in the scene.

Example

// Example of setting a render target for a camera component
CameraComponent camera = new CameraComponent();
Texture renderTargetTexture = Texture.CreateRenderTarget( width: 1024, height: 768 );
camera.RenderTarget = renderTargetTexture;

// Now the camera will render its view to the renderTargetTexture instead of the screen.