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 textures that can be rendered to, allowing for advanced rendering techniques such as off-screen rendering or post-processing effects. This method returns a TextureBuilder which is used to configure and finalize the creation of the render target. To complete the creation process, call Create on the returned TextureBuilder.

Render targets can be utilized in various graphics operations, such as rendering a scene to a texture using Graphics.RenderToTexture.

Usage

To create a render target, call the static method CreateRenderTarget on the Texture class. This will return a TextureBuilder object. Use this builder to set up the render target's properties and finalize its creation.

Example

// Example of creating a render target
TextureBuilder builder = Texture.CreateRenderTarget();
// Configure the builder as needed
// ...
// Finalize the creation of the render target
Texture renderTarget = builder.Create("MyRenderTarget", true, new ReadOnlySpan<byte>(), 0);