pub struct Texture {
pub width: u32,
pub height: u32,
pub format: TextureFormat,
/* private fields */
}
Fields
width: u32
height: u32
format: TextureFormat
Implementations
sourceimpl Texture
impl Texture
pub fn empty() -> Texture
pub fn gl_internal_id(&self) -> GLuint
sourcepub fn delete(&self)
pub fn delete(&self)
Delete GPU texture, leaving handle unmodified.
More high-level code on top of oxid probably is going to call this in Drop implementation of some more RAII buffer object.
There is no protection against using deleted textures later. However its not an UB in OpenGl and thats why this function is not marked as unsafe
sourceimpl Texture
impl Texture
sourcepub fn new_render_texture(ctx: &mut Context, params: TextureParams) -> Texture
pub fn new_render_texture(ctx: &mut Context, params: TextureParams) -> Texture
Shorthand for new(ctx, TextureAccess::RenderTarget, params)
pub fn new(
ctx: &mut Context,
_access: TextureAccess,
bytes: Option<&[u8]>,
params: TextureParams
) -> Texture
sourcepub fn from_data_and_format(
ctx: &mut Context,
bytes: &[u8],
params: TextureParams
) -> Texture
pub fn from_data_and_format(
ctx: &mut Context,
bytes: &[u8],
params: TextureParams
) -> Texture
Upload texture to GPU with given TextureParams
sourcepub fn from_rgba8(
ctx: &mut Context,
width: u16,
height: u16,
bytes: &[u8]
) -> Texture
pub fn from_rgba8(
ctx: &mut Context,
width: u16,
height: u16,
bytes: &[u8]
) -> Texture
Upload RGBA8 texture to GPU
pub fn set_filter(&self, ctx: &mut Context, filter: FilterMode)
pub fn resize(
&mut self,
ctx: &mut Context,
width: u32,
height: u32,
bytes: Option<&[u8]>
)
sourcepub fn update(&self, ctx: &mut Context, bytes: &[u8])
pub fn update(&self, ctx: &mut Context, bytes: &[u8])
Update whole texture content bytes should be width * height * 4 size - non rgba8 textures are not supported yet anyway
pub fn update_texture_part(
&self,
ctx: &mut Context,
x_offset: i32,
y_offset: i32,
width: i32,
height: i32,
bytes: &[u8]
)
sourcepub fn read_pixels(&self, bytes: &mut [u8])
pub fn read_pixels(&self, bytes: &mut [u8])
Read texture data into CPU memory
Trait Implementations
sourceimpl PartialEq<Texture> for Texture
impl PartialEq<Texture> for Texture
impl Copy for Texture
impl StructuralPartialEq for Texture
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more