Description
The WithScreenFormat
method is a member of the Texture2DBuilder
class in the Sandbox namespace. This method configures the texture to use a format that is optimized for screen rendering. It is particularly useful when creating textures that will be displayed directly on the screen, ensuring optimal performance and compatibility with screen-based rendering operations.
Usage
To use the WithScreenFormat
method, you must first create an instance of Texture2DBuilder
. Then, call the WithScreenFormat
method on this instance to set the texture format to a screen-optimized format. This method is chainable, meaning you can call other configuration methods on the same Texture2DBuilder
instance before finalizing the texture creation with the Finish
method.
Example
// Example of using WithScreenFormat
Texture2DBuilder builder = new Texture2DBuilder();
Texture texture = builder
.WithSize(1920, 1080) // Set the size of the texture
.WithScreenFormat() // Set the format to screen optimized
.Finish(); // Finalize and create the texture
// The texture is now ready to be used for screen rendering