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.

Implementations

impl Texture[src]

pub fn new(id: GLuint, width: u32, height: u32) -> Self[src]

Creates a new texture.

pub fn get_id(&self) -> GLuint[src]

Gets the OpenGL id of the texture.

pub fn empty(settings: &TextureSettings) -> Result<Self, String>[src]

Returns empty texture.

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

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]

Loads image by relative file name to the asset root.

pub fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self[src]

Creates a texture from image.

pub fn update(&mut self, img: &RgbaImage)[src]

Updates image with a new one.

Trait Implementations

impl CreateTexture<()> for Texture[src]

type Error = String

The error when creating texture.

impl Drop for Texture[src]

impl ImageSize for Texture[src]

impl UpdateTexture<()> for Texture[src]

type Error = String

The error when updating texture.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.