[−][src]Struct golem::Texture
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]
&mut self,
data: Option<&[u8]>,
width: u32,
height: u32,
color: ColorFormat
)
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]
&self,
data: &[u8],
x: u32,
y: u32,
width: u32,
height: u32,
color: ColorFormat
)
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
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,
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, 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.
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>,