Struct opengl_graphics::Texture [−][src]
pub struct Texture { /* fields omitted */ }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.
Methods
impl Texture[src]
impl Texturepub fn new(id: GLuint, width: u32, height: u32) -> Self[src]
pub fn new(id: GLuint, width: u32, height: u32) -> SelfCreates a new texture.
pub fn get_id(&self) -> GLuint[src]
pub fn get_id(&self) -> GLuintGets the OpenGL id of the texture.
pub fn empty(settings: &TextureSettings) -> Result<Self, String>[src]
pub fn empty(settings: &TextureSettings) -> Result<Self, String>Returns empty texture.
pub fn from_memory_alpha(
buf: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, String>[src]
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.
pub fn from_path<P>(path: P, settings: &TextureSettings) -> Result<Self, String> where
P: AsRef<Path>, [src]
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.
pub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self[src]
pub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> SelfCreates a texture from image.
pub fn update(&mut self, img: &RgbaImage)[src]
pub fn update(&mut self, img: &RgbaImage)Updates image with a new one.
Trait Implementations
impl Drop for Texture[src]
impl Drop for Textureimpl ImageSize for Texture[src]
impl ImageSize for Texturefn get_size(&self) -> (u32, u32)[src]
fn get_size(&self) -> (u32, u32)Get the image size.
fn get_width(&self) -> u32[src]
fn get_width(&self) -> u32Gets the image width.
fn get_height(&self) -> u32[src]
fn get_height(&self) -> u32Gets the image height.
impl CreateTexture<()> for Texture[src]
impl CreateTexture<()> for Texturetype Error = String
The error when creating texture.
fn create<S: Into<[u32; 2]>>(
_factory: &mut (),
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Self, Self::Error>[src]
fn create<S: Into<[u32; 2]>>(
_factory: &mut (),
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Self, Self::Error>Create texture from memory.
impl UpdateTexture<()> for Texture[src]
impl UpdateTexture<()> for Texture