1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Add a custom 3D demo using glow to egui_demo_app (#1546)

This commit is contained in:
Emil Ernerfeldt
2022-04-30 12:58:29 +02:00
committed by GitHub
parent bb421c7e8a
commit 3a83a600bb
7 changed files with 287 additions and 72 deletions

View File

@@ -20,6 +20,27 @@ pub use glow::Context;
const VERT_SRC: &str = include_str!("shader/vertex.glsl");
const FRAG_SRC: &str = include_str!("shader/fragment.glsl");
#[derive(Copy, Clone)]
pub enum TextureFilter {
Linear,
Nearest,
}
impl Default for TextureFilter {
fn default() -> Self {
TextureFilter::Linear
}
}
impl TextureFilter {
pub(crate) fn glow_code(&self) -> u32 {
match self {
TextureFilter::Linear => glow::LINEAR,
TextureFilter::Nearest => glow::NEAREST,
}
}
}
/// An OpenGL painter using [`glow`].
///
/// This is responsible for painting egui and managing egui textures.
@@ -56,27 +77,6 @@ pub struct Painter {
destroyed: bool,
}
#[derive(Copy, Clone)]
pub enum TextureFilter {
Linear,
Nearest,
}
impl Default for TextureFilter {
fn default() -> Self {
TextureFilter::Linear
}
}
impl TextureFilter {
pub(crate) fn glow_code(&self) -> u32 {
match self {
TextureFilter::Linear => glow::LINEAR,
TextureFilter::Nearest => glow::NEAREST,
}
}
}
impl Painter {
/// Create painter.
///