pub struct Texture { /* private fields */ }Implementations§
Source§impl Texture
impl Texture
Sourcepub fn new(params: TextureParameters) -> Result<Self>
pub fn new(params: TextureParameters) -> Result<Self>
Allocate a new texture with the given parameters. Texture allocation can fail if the texture size specified by the parameters is too small or large, or memory allocation fails.
Sourcepub fn load_image(&mut self, data: &[u8], face: Face) -> Result<()>
pub fn load_image(&mut self, data: &[u8], face: Face) -> Result<()>
Upload the provided data buffer to the texture, and to the given face if it’s a cube
texture. For flat textures, the face argument is not considered so Face::default()
can be used.
Sourcepub fn load_image_at_mipmap_level(
&mut self,
data: &[u8],
face: Face,
mipmap_level: u8,
) -> Result<()>
pub fn load_image_at_mipmap_level( &mut self, data: &[u8], face: Face, mipmap_level: u8, ) -> Result<()>
Upload the provided data buffer to the texture’s specific mipmap level, and to the given
face if it’s a cube texture. For flat textures, the face argument is not considered so
Face::default() can be used.
Sourcepub fn generate_mipmap(&mut self, face: Face)
pub fn generate_mipmap(&mut self, face: Face)
Generate a mipmap for this texture, and this face if it’s a cube texture.
For flat textures Face::default() or Face::TEX2D can be used.