TextureBuilder WithDynamicUsage()

book_4_sparkGenerated
code_blocksInput

Description

The WithDynamicUsage method of the TextureBuilder class provides a hint to the GPU that the texture being built 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, call it on an instance of TextureBuilder when you are configuring a texture that will be updated frequently. This method is part of a fluent interface, so it can be chained with other configuration methods provided by TextureBuilder.

Example

// Example of using WithDynamicUsage
TextureBuilder builder = new TextureBuilder();
Texture texture = builder
    .WithSize(256, 256)
    .WithDynamicUsage()
    .Create("DynamicTexture", false, data, data.Length);