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§
source§impl 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.