pub struct Texture2D {
    pub id: u32,
    pub width: u32,
    pub height: u32,
    pub config: Option<TextureConfig>,
}
Expand description

A abstract representation of a 2D texture

Example

let mut texture1 = Texture2D::new();
texture1.load_from_file("./src/a.png", TextureConfig::new());
texture1.send_data(30, 30, 1, 1, 0xFF000000 as ptr); // Set a red pixel on x: 30, y: 30

let data = vec![...];
let texture2 = Texture2D::new();
texture2.gen_texture(TextureConfig::new());
texture2.send_data(0, 0, 100, 200, data as ptr);

let texture3 = Texture2D::new();
texture3.load_from_memory(data as ptr, TextureConfig::new());

Fields

id: u32width: u32height: u32config: Option<TextureConfig>

Implementations

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.