Feat: add hidden mode and new documentation
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
//! OpenGL renderer errors and submodule.
|
||||
|
||||
use egui_glow::PainterError;
|
||||
use thiserror::Error;
|
||||
|
||||
pub mod renderer;
|
||||
|
||||
/// Errors from OpenGL context or painter initialization.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum OpenGlError {
|
||||
#[error("Failed to get baseview's GL context")]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Glow-based OpenGL renderer for egui inside a baseview window.
|
||||
|
||||
use baseview::{PhySize, Window};
|
||||
use egui::FullOutput;
|
||||
use egui_glow::Painter;
|
||||
@@ -5,6 +7,7 @@ use std::sync::Arc;
|
||||
|
||||
use super::OpenGlError;
|
||||
|
||||
/// OpenGL rendering options for the egui painter.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GraphicsConfig {
|
||||
/// Controls whether to apply dithering to minimize banding artifacts.
|
||||
@@ -32,12 +35,14 @@ impl Default for GraphicsConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Manages glow context and egui painter lifecycle.
|
||||
pub struct Renderer {
|
||||
glow_context: Arc<egui_glow::glow::Context>,
|
||||
painter: Painter,
|
||||
}
|
||||
|
||||
impl Renderer {
|
||||
/// Create a renderer from the baseview window's GL context.
|
||||
pub fn new(window: &Window, config: GraphicsConfig) -> Result<Self, OpenGlError> {
|
||||
let context = window.gl_context().ok_or(OpenGlError::NoContext)?;
|
||||
unsafe {
|
||||
@@ -71,6 +76,7 @@ impl Renderer {
|
||||
self.painter.max_texture_side()
|
||||
}
|
||||
|
||||
/// Render a completed egui frame to the window.
|
||||
pub fn render(
|
||||
&mut self,
|
||||
window: &Window,
|
||||
|
||||
Reference in New Issue
Block a user