static TextureBuilder CreateRenderTarget()
static Texture CreateRenderTarget( string name, ImageFormat format, Vector2 size )
static Texture CreateRenderTarget( string name, ImageFormat format, Vector2 size, Texture oldTexture )

book_4_sparkGenerated
code_blocksInput

Description

Begins creation of a render target. Render targets are used to render scenes or objects to a texture, which can then be used in various graphical effects or as a texture in the game world. This method returns a TextureBuilder that allows you to configure and finalize the creation of the render target. To complete the creation process, call Create on the returned TextureBuilder instance.

Usage

To create a render target, call CreateRenderTarget to obtain a TextureBuilder. Use the builder to set up the render target's properties, such as size and format, and then finalize the creation by calling Create on the builder.

Example

// Example of creating a render target
TextureBuilder builder = Texture.CreateRenderTarget();
// Configure the builder as needed
// builder.SetSize(1024, 1024);
// builder.SetFormat(ImageFormat.RGBA8);
Texture renderTarget = builder.Create("MyRenderTarget", true, null, 0);

// Use the render target in rendering
Graphics.RenderToTexture(sceneCamera, renderTarget);