Struct opengl_graphics::Texture [−] [src]

pub struct Texture {
    // some 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

fn new(id: GLuint, width: u32, height: u32) -> Self

Creates a new texture.

fn get_id(&self) -> GLuint

Gets the OpenGL id of the texture.

fn from_memory_alpha(buf: &[u8], width: u32, height: u32) -> Result<Self, String>

Loads image from memory, the format is 8-bit greyscale.

fn from_path(path: &Path) -> Result<Self, String>

Loads image by relative file name to the asset root.

fn from_image(img: &RgbaImage) -> Self

Creates a texture from image.

fn update(&mut self, img: &RgbaImage)

Updates image with a new one.

Trait Implementations

impl Drop for Texture

fn drop(&mut self)

impl ImageSize for Texture

fn get_size(&self) -> (u32, u32)

fn get_width(&self) -> u32

fn get_height(&self) -> u32