TextureBuilder WithScreenFormat()

book_4_sparkGenerated
code_blocksInput

Description

The WithScreenFormat method of the TextureBuilder class sets the internal texture format to match the format used by the screen or frame buffer. This ensures that the texture is compatible with the display settings, potentially optimizing rendering performance and visual fidelity.

Usage

To use the WithScreenFormat method, first create an instance of TextureBuilder. Then, call the WithScreenFormat method on this instance to set the texture format to match the screen's format. This method is chainable, allowing you to configure multiple properties of the texture in a fluent manner.

Example

// Example of using WithScreenFormat
TextureBuilder textureBuilder = new TextureBuilder();
textureBuilder.WithScreenFormat();

// Continue configuring the texture as needed
textureBuilder.WithSize(1024, 768)
              .WithDynamicUsage();

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