Struct glin::texture::Texture[][src]

pub struct Texture { /* fields omitted */ }

Wraps an OpenGL texture + some metadata about it’s format

Implementations

impl Texture[src]

pub fn is_dsa(&self) -> bool[src]

Returns true if the Texture is backed by a DSA backend

pub fn load_data<T: 'static>(
    &mut self,
    data: &[T],
    format: DataFormat
) -> Result<()>
[src]

Upload data to the texture

The function will check that the data dimensions are correct for the passed format and the allocated size.

DataFormat implements Default so it usually doesn’t need to be fully specified see it’s documentation for more information.

pub fn load_buffer<T: 'static, B>(
    &mut self,
    buffer: &B,
    format: DataFormat
) -> Result<()> where
    B: BufferRange<T>, 
[src]

Load data to the texture from a Buffer

The function will check that the data dimensions are correct for the passed format and the allocated size

DataFormat implements Default so it usually doesn’t need to be fully specified see it’s documentation for more information.

pub fn load_compressed_data<T: 'static>(
    &mut self,
    data: &[T],
    format: CompressedDataFormat
) -> Result<()>
[src]

Upload data to the texture

The function will check that the data dimensions are correct for the passed format and the allocated size. Also that the passed texture format is the same as the allocated internal

CompressedDataFormat implements Default so it usually doesn’t need to be fully specified see it’s documentation for more information.

pub fn load_compressed_buffer<B, T: 'static>(
    &mut self,
    buffer: &B,
    format: CompressedDataFormat
) -> Result<()> where
    B: BufferRange<T>, 
[src]

Load data to the texture from a GPU Buffer

The function will check that the data dimensions are correct for the passed format and the allocated size. Also that the passed texture format is the same as the allocated internal

CompressedDataFormat implements Default so it usually doesn’t need to be fully specified see it’s documentation for more information.

pub fn load_level_from_image<I: Image>(
    &mut self,
    img: &I,
    level: u32
) -> Result<()>
[src]

Upload data to a texture level from an image

The function will check that the data dimensions are correct for the passed format and the allocated size

pub fn load_image<I: Image>(&mut self, img: &I) -> Result<()>[src]

Upload data to the texture from an image

If the image has more than one level it’ll try to upload all the levels to the textyre

The function will check that the data dimensions are correct for the passed format and the allocated size

pub fn width(&self) -> u32[src]

Returns the width of the allocated texture

pub fn height(&self) -> u32[src]

Returns the height of the allocated texture

pub fn depth(&self) -> u32[src]

Returns the depth of the allocated texture

pub fn aspect_ratio(&self) -> f32[src]

Returns the aspect ratio of the allocated texture

pub fn size(&self) -> (u32, u32)[src]

Returns the size of the allocated texture as (width, height)

pub fn samples(&self) -> u32[src]

Returns the samples of the allocated texture

pub fn levels(&self) -> u32[src]

Returns the number of allocated levels

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

Returns the GL id

pub fn target(&self) -> GLenum[src]

Returns the texture target

pub fn internal_format(&self) -> GLenum[src]

Returns the internal format

pub fn view(&self) -> Texture[src]

pub fn set_rg_to_rgba_swizzles(&mut self)[src]

Swizzle from r -> rgb and g -> a

Useful to show grayscale or alpha + grayscale as grayscale instead of red tinted using the same shader one would use for an rgb(a) texture

pub fn set_swizzle_r(&mut self, component: Component)[src]

Swizzle r -> component

pub fn set_swizzle_g(&mut self, component: Component)[src]

Swizzle g -> component

pub fn set_swizzle_b(&mut self, component: Component)[src]

Swizzle b -> component

pub fn set_swizzle_a(&mut self, component: Component)[src]

Swizzle a -> component

pub fn set_swizzles(&mut self, swizzles: Swizzles)[src]

Sets a group of Swizzles

pub unsafe fn read_to<T>(&self, pixels: &mut [T], format: GLenum, ty: GLenum)[src]

Reads back the contents of the texture into the passed pixels

pub unsafe fn read_to_buffer<T, B>(
    &self,
    buffer: &mut B,
    format: GLenum,
    ty: GLenum
) where
    B: BufferRange<T>, 
[src]

Reads back the contents of the texture into the passed pixels

pub fn set_anisotropy_level(&mut self, level: f32)[src]

GL_TEXTURE_MAX_ANISOTROPY_EXT

pub fn set_base_level(&mut self, level: GLint)[src]

GL_TEXTURE_BASE_LEVEL

pub fn set_max_level(&mut self, level: GLint)[src]

GL_TEXTURE_MAX_LEVEL

pub fn set_min_lod(&mut self, level: GLint)[src]

GL_TEXTURE_MIN_LOD

pub fn set_max_lod(&mut self, level: GLint)[src]

GL_TEXTURE_MAX_LOD

pub fn set_min_mag_filters(&mut self, min: GLuint, mag: GLuint)[src]

GL_TEXTURE_MIN_MAG_FILTERS

pub fn set_wrap_s(&mut self, wrap: GLenum)[src]

GL_TEXTURE_WRAP_S

pub fn set_wrap_t(&mut self, wrap: GLenum)[src]

GL_TEXTURE_WRAP_T

pub fn set_wrap_r(&mut self, wrap: GLenum)[src]

GL_TEXTURE_WRAP_R

pub fn set_compare_mode(&mut self, mode: GLenum)[src]

pub fn set_compare_func(&mut self, mode: GLenum)[src]

pub fn set_border_color(&mut self, color: &[f32; 4])[src]

GL_TEXTURE_BORDER_COLOR

pub fn level_width(&self, level: u32) -> u32[src]

GL_TEXTURE_WIDTH

pub fn level_height(&self, level: u32) -> u32[src]

GL_TEXTURE_HEIGHT

pub fn level_internal_format(&self, level: u32) -> GLenum[src]

GL_TEXTURE_INTERNAL_FORMAT

pub fn level_red_type(&self, level: u32) -> GLenum[src]

GL_TEXTURE_RED_TYPE

pub fn level_green_type(&self, level: u32) -> GLenum[src]

GL_TEXTURE_GREEN_TYPE

pub fn level_blue_type(&self, level: u32) -> GLenum[src]

GL_TEXTURE_BLUE_TYPE

pub fn level_alpha_type(&self, level: u32) -> GLenum[src]

GL_TEXTURE_ALPHA_TYPE

pub fn is_level_compressed(&self, level: u32) -> bool[src]

GL_TEXTURE_COMPRESSED

pub fn level_compressed_image_len(&self, level: u32) -> usize[src]

GL_TEXTURE_COMPRESSED_IMAGE_SIZE

pub fn level_red_size(&self, level: u32) -> usize[src]

GL_TEXTURE_RED_SIZE

pub fn level_green_size(&self, level: u32) -> usize[src]

GL_TEXTURE_GREEN_SIZE

pub fn level_blue_size(&self, level: u32) -> usize[src]

GL_TEXTURE_BLUE_SIZE

pub fn level_alpha_size(&self, level: u32) -> usize[src]

GL_TEXTURE_ALPHA_SIZE

pub fn depth_stencil_texture_mode(&self) -> GLenum[src]

GL_DEPTH_STENCIL_TEXTURE_MODE

pub fn mag_filter(&self) -> GLenum[src]

GL_TEXTURE_MAG_FILTER

pub fn min_filter(&self) -> GLenum[src]

GL_TEXTURE_MIN_FILTER

pub fn min_lod(&self) -> i32[src]

GL_TEXTURE_MIN_LOD

pub fn max_lod(&self) -> i32[src]

GL_TEXTURE_MAX_LOD

pub fn base_level(&self) -> i32[src]

GL_TEXTURE_BASE_LEVEL

pub fn max_level(&self) -> i32[src]

GL_TEXTURE_MAX_LEVEL

pub fn swizzle_r(&self) -> Component[src]

GL_TEXTURE_SWIZZLE_R

pub fn swizzle_g(&self) -> Component[src]

GL_TEXTURE_SWIZZLE_G

pub fn swizzle_b(&self) -> Component[src]

GL_TEXTURE_SWIZZLE_B

pub fn swizzle_a(&self) -> Component[src]

GL_TEXTURE_SWIZZLE_A

pub fn swizzles(&self) -> Swizzles[src]

GL_TEXTURE_SWIZZLE_RGBA

pub fn wrap_s(&self) -> GLenum[src]

GL_TEXTURE_WRAP_S

pub fn wrap_t(&self) -> GLenum[src]

GL_TEXTURE_WRAP_T

pub fn wrap_r(&self) -> GLenum[src]

GL_TEXTURE_WRAP_R

pub fn border_color(&self) -> [f32; 4][src]

GL_TEXTURE_BORDER_COLOR

pub fn compare_mode(&self) -> GLenum[src]

GL_TEXTURE_COMPARE_MODE

pub fn compare_func(&self) -> GLenum[src]

GL_TEXTURE_COMPARE_FUNC

pub fn image_format_compatibility_type(&self) -> GLenum[src]

GL_IMAGE_FORMAT_COMPATIBILITY_TYPE

pub unsafe fn set_parameteri(&mut self, parameter: GLenum, value: GLint)[src]

pub unsafe fn set_parameterf(&mut self, parameter: GLenum, value: GLfloat)[src]

pub unsafe fn get_level_parameteriv(
    &self,
    parameter: GLenum,
    level: u32
) -> GLint
[src]

pub unsafe fn get_parameteri(&self, parameter: GLenum) -> GLint[src]

pub unsafe fn get_parameterf(&self, parameter: GLenum) -> GLfloat[src]

pub unsafe fn get_parameterfv(
    &self,
    parameter: GLenum,
    len: usize
) -> Vec<GLfloat>
[src]

pub fn generate_mipmaps(&self)[src]

glGenerateMipmaps

pub fn format(&self) -> Format[src]

Returns the texture format

pub fn texture_sampler<'a>(&'a self, sampler: &'a Sampler) -> TextureSampler<'a>[src]

Trait Implementations

impl<T: Borrow<Texture>> AsUniform<Texture> for T[src]

impl<'a> BorrowColorAttach for &'a Texture[src]

impl<'a> BorrowDepthAttach for &'a Texture[src]

impl ColorAttach for Texture[src]

impl Debug for Texture[src]

impl DepthAttach for Texture[src]

impl Drop for Texture[src]

impl PartialEq<Texture> for Texture[src]

impl Eq 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]

impl<T> Any for T where
    T: Any
[src]

impl<T> AsUniform<Texture> for T where
    T: Borrow<Texture>, 
[src]

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

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.