mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
add texture registering function
This commit is contained in:
@@ -250,7 +250,17 @@ impl Painter {
|
||||
self.user_textures.push(Some(Default::default()));
|
||||
id
|
||||
}
|
||||
|
||||
/// register glium texture as egui texture
|
||||
/// Usable for render to image rectangle
|
||||
pub fn register_glium_texture(&mut self,texture:glium::texture::SrgbTexture2d)->egui::TextureId{
|
||||
let id= self.alloc_user_texture();
|
||||
if let egui::TextureId::User(id)=id{
|
||||
if let Some(Some(user_texture))=self.user_textures.get_mut(id as usize){
|
||||
*user_texture=UserTexture{ pixels: vec![], gl_texture: Some(texture) }
|
||||
}
|
||||
}
|
||||
id
|
||||
}
|
||||
pub fn set_user_texture(
|
||||
&mut self,
|
||||
id: egui::TextureId,
|
||||
|
||||
Reference in New Issue
Block a user