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

robot_2Generated
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 facilitates the construction of the render target. To complete the creation process, you must call TextureBuilder.Create with the appropriate parameters.

Usage

To use CreateRenderTarget, call it statically from the Texture class. This will return a TextureBuilder object, which you can use to configure and finalize the render target. Once configured, call Create on the TextureBuilder to generate the render target.

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);