Struct opengl_graphics::Texture [−][src]
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]
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]
P: AsRef<Path>,
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.
fn create<S: Into<[u32; 2]>>(
_factory: &mut (),
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Self, Self::Error>
[src]
_factory: &mut (),
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Self, Self::Error>
impl Drop for Texture
[src]
impl ImageSize for Texture
[src]
fn get_size(&self) -> (u32, u32)
[src]
pub fn get_width(&self) -> u32
[src]
pub fn get_height(&self) -> u32
[src]
impl UpdateTexture<()> for Texture
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
[src]
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,