pub struct Texture2D {
pub texture: Texture,
/* private fields */
}
Expand description
A Texture2D
representation.
Fields§
§texture: Texture
Base texture object.
Implementations§
Source§impl Texture2D
impl Texture2D
Sourcepub fn dimensions(&self) -> (usize, usize)
pub fn dimensions(&self) -> (usize, usize)
Gets the dimensions.
Sourcepub fn allocate(
context: &Context,
dimension: (usize, usize),
format: &TextureFormat,
) -> Self
pub fn allocate( context: &Context, dimension: (usize, usize), format: &TextureFormat, ) -> Self
Allocates a new Texture2D
with the specified dimensions and TextureFormat
.
Sourcepub fn from_data<T>(
context: &Context,
dimension: (usize, usize),
format: &TextureFormat,
data: &[T],
data_format: &TextureFormat,
) -> Self
pub fn from_data<T>( context: &Context, dimension: (usize, usize), format: &TextureFormat, data: &[T], data_format: &TextureFormat, ) -> Self
Creates a new Texture2D
from a slice.
Sourcepub fn reallocate(&mut self, dimensions: (usize, usize), format: &TextureFormat)
pub fn reallocate(&mut self, dimensions: (usize, usize), format: &TextureFormat)
Reallocates the memory on the GPU side.
Sourcepub fn set_data<T>(
&mut self,
dimensions: (usize, usize),
format: &TextureFormat,
data: &[T],
data_format: &TextureFormat,
)
pub fn set_data<T>( &mut self, dimensions: (usize, usize), format: &TextureFormat, data: &[T], data_format: &TextureFormat, )
Gets a copy of the data on the GPU.
Trait Implementations§
Source§impl BorrowMut<Texture> for Texture2D
impl BorrowMut<Texture> for Texture2D
Source§fn borrow_mut(&mut self) -> &mut Texture
fn borrow_mut(&mut self) -> &mut Texture
Mutably borrows from an owned value. Read more
Auto Trait Implementations§
impl Freeze for Texture2D
impl RefUnwindSafe for Texture2D
impl !Send for Texture2D
impl !Sync for Texture2D
impl Unpin for Texture2D
impl UnwindSafe for Texture2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more