Struct Texture

Source
pub struct Texture { /* private fields */ }

Implementations§

Source§

impl Texture

Source

pub fn new(params: TextureParameters) -> Result<Self>

Allocate a new texture with the given parameters. Texture allocation can fail if the texture size specified by the parameters is too small or large, or memory allocation fails.

Source

pub fn load_image(&mut self, data: &[u8], face: Face) -> Result<()>

Upload the provided data buffer to the texture, and to the given face if it’s a cube texture. For flat textures, the face argument is not considered so Face::default() can be used.

Source

pub fn load_image_at_mipmap_level( &mut self, data: &[u8], face: Face, mipmap_level: u8, ) -> Result<()>

Upload the provided data buffer to the texture’s specific mipmap level, and to the given face if it’s a cube texture. For flat textures, the face argument is not considered so Face::default() can be used.

Source

pub fn generate_mipmap(&mut self, face: Face)

Generate a mipmap for this texture, and this face if it’s a cube texture. For flat textures Face::default() or Face::TEX2D can be used.

Source

pub fn set_filter(&mut self, mag_filter: Filter, min_filter: Filter)

Source

pub fn set_filter_mipmap(&mut self, filter: Filter)

Source

pub fn set_wrap(&mut self, wrap_s: Wrap, wrap_t: Wrap)

Source

pub fn set_lod_bias(&mut self, lod_bias: f32)

Source

pub fn width(&self) -> u16

Source

pub fn height(&self) -> u16

Source

pub fn param(&self) -> u32

Source

pub fn format(&self) -> ColorFormat

Source

pub fn lod_bias(&self) -> u16

Source

pub fn max_level(&self) -> u8

Source

pub fn min_level(&self) -> u8

Trait Implementations§

Source§

impl Drop for Texture

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Texture

§

impl RefUnwindSafe for Texture

§

impl !Send for Texture

§

impl !Sync for Texture

§

impl Unpin for Texture

§

impl UnwindSafe for Texture

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.