[][src]Struct golem::Texture

pub struct Texture { /* fields omitted */ }

An image stored on the GPU

Implementations

impl Texture[src]

pub fn new(ctx: &Context) -> Result<Texture, GolemError>[src]

Create a new, empty texture

pub fn set_active(&self, bind_point: NonZeroU32)[src]

Mark the texture as active, allowing it to be used in shaders

To use the texture in a shader, supply the same number as the bind_point to a UniformValue::Int, matching a Uniform with a UniformType::Sampler2D.

The value 0 is reserved by golem, so it cannot be passed to this function.

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

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

pub fn set_image(
    &mut self,
    data: Option<&[u8]>,
    width: u32,
    height: u32,
    color: ColorFormat
)
[src]

Set the image data associated with this texture

width and height must be less than the maximum texture size of the GPU, given by glow::MAX_TEXTURE_SIZE. If they are both powers of 2, mipmaps will be generated. If they aren't, mipmaps will be unavailable.

If 'data' is None, the image will be created with no data at the given dimensions. If it is Some, it needs to be at least as long as width * height * [color.bytes_per_pixel`])

pub fn set_subimage(
    &self,
    data: &[u8],
    x: u32,
    y: u32,
    width: u32,
    height: u32,
    color: ColorFormat
)
[src]

Set a region of the texture data

The data provided must be enough to cover width * height * [color.bytes_per_pixel()]. Also, the region must be within the texture's bounds.

pub fn set_minification(&self, min: TextureFilter) -> Result<(), GolemError>[src]

Determine how the texture should scale down

pub fn set_magnification(&self, max: TextureFilter) -> Result<(), GolemError>[src]

Determine how the texture should scale up

pub fn set_wrap_h(&self, wrap: TextureWrap) -> Result<(), GolemError>[src]

Determine how the texture is wrapped horizontally

pub fn set_wrap_v(&self, wrap: TextureWrap) -> Result<(), GolemError>[src]

Determine how the texture is wrapped vertically

Trait Implementations

impl Drop 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> Borrow<T> for T where
    T: ?Sized
[src]

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

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

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

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.