[][src]Struct opengl_graphics::Texture

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]

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 Drop for Texture
[src]

impl ImageSize for Texture
[src]

fn get_width(&self) -> u32

Gets the image width.

fn get_height(&self) -> u32

Gets the image height.

impl CreateTexture<()> for Texture
[src]

type Error = String

The error when creating texture.

impl UpdateTexture<()> for Texture
[src]

type Error = String

The error when updating texture.

Auto Trait Implementations

impl Send for Texture

impl Sync for Texture

Blanket Implementations

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

impl<T> From for T
[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.