Struct glitter::context::texture_context::Texture2dBuilder
[−]
[src]
pub struct Texture2dBuilder<'a, C> where
C: 'a + TextureUnit0Context, { /* fields omitted */ }
Provide a safe interface for building a 2D texture
object that is checked to be complete. A Texture2dBuilder
can be created using the gl.build_texture_2d
method.
Methods
impl<'a, C> Texture2dBuilder<'a, C> where
C: TextureUnit0Context,
[src]
C: TextureUnit0Context,
pub fn image_2d(self, image: &'a Image2d) -> Self
[src]
Set the 2D image data to fill the texture with.
pub fn empty(self, format: ImageFormat, width: u32, height: u32) -> Self
[src]
Set the parameters for creating an empty texture.
pub fn generate_mipmap(self) -> Self
[src]
Automatically generate mipmaps for the texture.
pub fn min_filter<I>(self, filter: I) -> Self where
I: Into<TextureMipmapFilter>,
[src]
I: Into<TextureMipmapFilter>,
Set the texture's minifying filter.
pub fn mag_filter(self, filter: TextureFilter) -> Self
[src]
Set the texture's magnifying filter.
pub fn wrap_s(self, wrap: TextureWrapMode) -> Self
[src]
Set the texture's wrap mode for the s-coordinate.
pub fn wrap_t(self, wrap: TextureWrapMode) -> Self
[src]
Set the texture's wrap mode for the t-coordinate.
pub fn try_unwrap(self) -> Result<Texture2d, GLError>
[src]
Create and return a texture with the specified options, or return an error.
Failures
If any of the following conditions are met, an error will be returned:
- The texture is not complete.
- The texture was set to be empty, but either the width or height were 0.
- The texture was neither set to be empty with
empty
, nor had any image data supplied withimage_2d
. - The texture had a mipmap filter set for the
min_filter
, but mimaps were not generated usinggenerate_mipmaps
.
pub fn unwrap(self) -> Texture2d
[src]
Create a texture with the specified options, or panic.
Panic
See the try_unwrap
method docs for all of the possible failure cases when building
a texture.