Skip to main content

GlRenderer

Struct GlRenderer 

Source
pub struct GlRenderer { /* private fields */ }
Expand description

The live GL renderer: a Presenter, wrapped in WindowBackend to form a full Backend for the windowing loop.

It does not implement Input or Cursor itself: a GL renderer cannot present without a live context, so there is no headless-with-input use for a bare Terminal<GlRenderer>. In windowed use WindowBackend owns the input queue (with its Mouse(Moved) coalescing) and the no-op cursor, so a duplicate queue here would only ever be dead. See the sub-cell offset note on Presenter for the shared rendering contract.

Build one with GlBackendBuilder. Before the windowing loop calls init_surface there is no GL context; drawing updates only the CPU-side instance array, and present is a no-op. Once the surface exists, present uploads changed cells and issues the single instanced draw call.

Trait Implementations§

Source§

impl Drop for GlRenderer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Output for GlRenderer

Source§

type Error = Infallible

Error type returned by fallible operations.
Source§

fn draw_layers<'a, I>(&mut self, content: I) -> Result<(), Self::Error>
where I: Iterator<Item = DrawCell<'a>>,

Draw changed cells across all layers. Read more
Source§

fn needs_full_frame(&self) -> bool

Returns true if the backend needs the entire frame (all cells on all layers) on every call to draw_layers, rather than just the changed cells. Read more
Source§

fn composites_layers(&self) -> bool

Whether this backend composites layers itself (per pixel or quad), receiving the raw layered stream from draw_layers. Read more
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Flush buffered output to the display. Read more
Source§

fn size(&self) -> Size

Return current display dimensions.
Source§

fn clear(&mut self) -> Result<(), Self::Error>

Clear the entire display. Read more
Source§

fn resize(&mut self, size: Size)

Notify the backend of a resize to size, updating what size reports. Read more
Source§

fn draw<'a, I>(&mut self, content: I) -> Result<(), Self::Error>
where I: Iterator<Item = DrawCell<'a>>,

Draw changed cells to the output surface, layer 0 only. Read more
Source§

impl Presenter for GlRenderer

Source§

type SurfaceError = SurfaceError

Surface lifecycle error (context creation, buffer acquisition, present).
Source§

fn init_surface( &mut self, window: Arc<dyn WindowHandle>, ) -> Result<(), SurfaceError>

Initialize the window surface. Read more
Source§

fn resize_surface(&mut self, width: u32, height: u32)

Resize the window surface to a new physical pixel size. Read more
Source§

fn present(&mut self) -> Result<(), SurfaceError>

Present the rasterized frame to the window surface. Read more
Source§

fn cell_size(&self) -> (u32, u32)

Cell size in physical pixels (width, height). Read more
Source§

fn geometry(&self) -> CellGeometry

This presenter’s cell geometry, as a CellGeometry rather than the raw (width, height) pair cell_size returns. Read more
Source§

fn scale_factor_changed(&mut self, _scale_factor: f64)

Notify the presenter that the window’s scale factor (DPI) changed. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,