1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00

Add api for accessing backend texture via epi (#695)

* Define NativeTexture trait for offscreen rendering
add demo for NativeTexture trait

* write changelog

* add comment for native texture example

* formatting

* add license of Rust logo

* NativeTexture trait method rename
remove duplicate function with native texture
remove rust logo

* deprecated notice for register_glium_texture,register_webgl_texture

* collect deprecated notice
This commit is contained in:
triangle drawer
2021-09-05 18:00:45 +09:00
committed by GitHub
parent acf9d0114d
commit 203d571c8b
10 changed files with 227 additions and 5 deletions

View File

@@ -304,6 +304,18 @@ pub trait TextureAllocator {
fn free(&mut self, id: egui::TextureId);
}
/// Abstraction for platform dependent texture reference
pub trait NativeTexture {
type Texture;
/// Bind native texture to egui texture
fn register_native_texture(&mut self, native: Self::Texture) -> egui::TextureId;
/// Change id's actual pointing texture
/// only for user texture
fn replace_native_texture(&mut self, id: egui::TextureId, replacing: Self::Texture);
}
/// How to signal the [`egui`] integration that a repaint is required.
pub trait RepaintSignal: Send + Sync {
/// This signals the [`egui`] integration that a repaint is required.