Struct opengles_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]
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 empty() -> Result<Self, String>
Returns empty texture.
fn from_memory_alpha(buf: &[u8],
width: u32,
height: u32,
settings: &TextureSettings)
-> Result<Self, String>
width: u32,
height: u32,
settings: &TextureSettings)
-> Result<Self, String>
Loads image from memory, the format is 8-bit greyscale.
fn from_path<P>(path: P) -> Result<Self, String> where P: AsRef<Path>
Loads image by relative file name to the asset root.
fn from_image(img: &RgbaImage, settings: &TextureSettings) -> Self
Creates a texture from image.
fn update(&mut self, img: &RgbaImage)
Updates image with a new one.
Trait Implementations
impl Drop for Texture
[src]
impl ImageSize for Texture
[src]
fn get_size(&self) -> (u32, u32)
Get the image size.
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.
fn create<S: Into<[u32; 2]>>(_factory: &mut (),
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings)
-> Result<Self, Self::Error>
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings)
-> Result<Self, Self::Error>
Create texture from memory.