TextureBuilder WithDynamicUsage()

robot_2Generated
code_blocksInput

Description

The WithDynamicUsage method of the TextureBuilder class provides a hint to the GPU that the texture will be updated regularly, almost every frame. This is useful for textures that are expected to change frequently, allowing the GPU to optimize its handling of the texture data accordingly.

Usage

To use the WithDynamicUsage method, first create an instance of TextureBuilder. Then, call the WithDynamicUsage method on this instance to set the usage hint for the texture. This method can be chained with other configuration methods of TextureBuilder to fully define the texture's properties before creating it.

Example

// Example of using WithDynamicUsage
TextureBuilder builder = new TextureBuilder();
builder = builder.WithDynamicUsage();

// Further configuration can be chained
builder = builder.WithSize(256, 256).WithFormat(ImageFormat.RGBA8);

// Finally, create the texture
Texture texture = builder.Create("DynamicTexture", false, data, data.Length);