Struct opengl_graphics::Texture
source · [−]pub struct Texture { /* private fields */ }
Expand description
Wraps OpenGL texture data. The texture gets deleted when running out of scope.
In order to create a texture the function GenTextures
must be loaded.
This is done automatically by the window back-ends in Piston.
Implementations
sourceimpl Texture
impl Texture
sourcepub fn empty(settings: &TextureSettings) -> Result<Self, String>
pub fn empty(settings: &TextureSettings) -> Result<Self, String>
Returns empty texture.
sourcepub fn from_memory_alpha(
buf: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, String>
pub fn from_memory_alpha(
buf: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, String>
Loads image from memory, the format is 8-bit greyscale.
sourcepub fn from_path<P>(path: P, settings: &TextureSettings) -> Result<Self, String> where
P: AsRef<Path>,
pub fn from_path<P>(path: P, settings: &TextureSettings) -> Result<Self, String> where
P: AsRef<Path>,
Loads image by relative file name to the asset root.
sourcepub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self
pub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self
Creates a texture from image.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnwindSafe for Texture
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more