mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Make egui_glow painter to work on web (#868)
Add WebGL1 and WebGL2 support to glow painter. Add "glow" feature to egui_web to use the glow painter there. Make winit an optional part of egui_glow
This commit is contained in:
@@ -5,6 +5,11 @@ pub use egui::{pos2, Color32};
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
fn create_painter(canvas_id: &str) -> Result<Box<dyn Painter>, JsValue> {
|
||||
#[cfg(feature = "glow")]
|
||||
return Ok(Box::new(crate::glow_wrapping::WrappedGlowPainter::new(
|
||||
canvas_id,
|
||||
)));
|
||||
#[cfg(not(feature = "glow"))]
|
||||
if let Ok(webgl2_painter) = webgl2::WebGl2Painter::new(canvas_id) {
|
||||
console_log("Using WebGL2 backend");
|
||||
Ok(Box::new(webgl2_painter))
|
||||
@@ -167,7 +172,7 @@ impl AppRunner {
|
||||
|
||||
fn integration_info(&self) -> epi::IntegrationInfo {
|
||||
epi::IntegrationInfo {
|
||||
name: "egui_web",
|
||||
name: self.painter.name(),
|
||||
web_info: Some(epi::WebInfo {
|
||||
web_location_hash: location_hash().unwrap_or_default(),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user