pub struct Texture {
pub format: u32,
/* private fields */
}Fields§
§format: u32Implementations§
Source§impl Texture
impl Texture
pub fn from_font_atlas_data( gl: &Context, format: u32, atlas: &FontAtlasData, ) -> Result<Self, Error>
Sourcepub fn for_dynamic_font_atlas(
gl: &Context,
format: u32,
cell_size: (i32, i32),
initial_layers: i32,
) -> Result<Self, Error>
pub fn for_dynamic_font_atlas( gl: &Context, format: u32, cell_size: (i32, i32), initial_layers: i32, ) -> Result<Self, Error>
Creates an empty texture array for dynamic glyph rasterization.
Allocates a fixed-size 2D texture array and initializes all layers to transparent black (RGBA 0,0,0,0).
LRU eviction: When the glyph cache evicts old entries, the texture slots are reused. The new glyph completely overwrites the slot, so no explicit clearing is needed on eviction.
§Arguments
gl- GL contextformat- Texture formatcell_size- (width, height) of each glyph cell in pixelsinitial_layers- Number of texture layers to allocate initially
Sourcepub fn upload_glyph(
&self,
gl: &Context,
glyph_id: u16,
padded_cell_size: (i32, i32),
rasterized: &RasterizedGlyph,
) -> Result<(), Error>
pub fn upload_glyph( &self, gl: &Context, glyph_id: u16, padded_cell_size: (i32, i32), rasterized: &RasterizedGlyph, ) -> Result<(), Error>
Uploads a rasterized glyph to the texture at the position determined by its ID.
Glyph positions follow the layout: layer = id / 32, y = (id % 32) * cell_height
Sourcepub fn dimensions(&self) -> (i32, i32, i32)
pub fn dimensions(&self) -> (i32, i32, i32)
Returns the texture dimensions (width, height, layers)
pub fn bind(&self, gl: &Context)
pub fn delete(&self, gl: &Context)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Texture
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
impl UnwindSafe for Texture
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