pub struct Renderer { /* private fields */ }
Implementations
sourceimpl Renderer
impl Renderer
sourcepub fn new() -> Renderer
pub fn new() -> Renderer
Instantiates a new (unconnected) Renderer
object:: A
Renderer
represents a means to render. It encapsulates the
selection of an underlying driver, such as OpenGL or OpenGL-ES and
a selection of a window system binding API such as GLX, or EGL or
WGL.
While the renderer is unconnected it can be configured so that
applications may specify backend constraints, such as “must use
x11” for example via Renderer::add_constraint
.
There are also some platform specific configuration apis such
as xlib_renderer_set_foreign_display
that may also be
used while the renderer is unconnected.
Once the renderer has been configured, then it may (optionally) be
explicitly connected using Renderer::connect
which allows
errors to be handled gracefully and potentially fallback
configurations can be tried out if there are initial failures.
If a renderer is not explicitly connected then Display::new
will automatically connect the renderer for you. If you don’t
have any code to deal with error/fallback situations then its fine
to just let do the connection for you.
Once you have setup your renderer then the next step is to create a
Display
using Display::new
.
Many applications don’t need to explicitly use
Renderer::new
or Display::new
and can just jump
straight to Context::new
and pass a None
display argument
so will automatically connect and setup a renderer and
display.
Returns
A newly created Renderer
.
sourcepub fn add_constraint(&self, constraint: RendererConstraint)
pub fn add_constraint(&self, constraint: RendererConstraint)
This adds a renderer selection constraint
.
Applications should ideally minimize how many of these constraints they depend on to ensure maximum portability.
constraint
A RendererConstraint
to add
sourcepub fn check_onscreen_template(
&self,
onscreen_template: &OnscreenTemplate
) -> bool
pub fn check_onscreen_template(
&self,
onscreen_template: &OnscreenTemplate
) -> bool
Tests if a given onscreen_template
can be supported with the given
self
.
onscreen_template
A OnscreenTemplate
Returns
true
if the onscreen_template
can be supported,
else false
.
sourcepub fn connect(&self) -> bool
pub fn connect(&self) -> bool
Connects the configured self
. Renderer connection isn’t a
very active process, it basically just means validating that
any given constraint criteria can be satisfied and that a
usable driver and window system backend can be found.
Returns
true
if there was no error while connecting the
given self
. false
if there was an error.
sourcepub fn foreach_output<P: FnMut(&Output)>(&self, callback: P)
pub fn foreach_output<P: FnMut(&Output)>(&self, callback: P)
sourcepub fn driver(&self) -> Driver
pub fn driver(&self) -> Driver
Queries what underlying driver is being used by .
This may only be called on a connected Renderer
.
sourcepub fn n_fragment_texture_units(&self) -> i32
pub fn n_fragment_texture_units(&self) -> i32
Queries how many texture units can be used from fragment programs
Returns
the number of texture image units.
sourcepub fn winsys_id(&self) -> WinsysID
pub fn winsys_id(&self) -> WinsysID
Queries which window system backend has chosen to use.
This may only be called on a connected Renderer
.
Returns
The WinsysID
corresponding to the chosen window
system backend.
sourcepub fn remove_constraint(&self, constraint: RendererConstraint)
pub fn remove_constraint(&self, constraint: RendererConstraint)
This removes a renderer selection constraint
.
Applications should ideally minimize how many of these constraints they depend on to ensure maximum portability.
constraint
A RendererConstraint
to remove
sourcepub fn set_driver(&self, driver: Driver)
pub fn set_driver(&self, driver: Driver)
Requests that should try to use a specific underlying driver for rendering.
If you select an unsupported driver then Renderer::connect
will fail and report an error. Most applications should not
explicitly select a driver and should rely on automatically
choosing the driver.
This may only be called on an un-connected Renderer
.
sourcepub fn set_winsys_id(&self, winsys_id: WinsysID)
pub fn set_winsys_id(&self, winsys_id: WinsysID)
This allows you to explicitly select a winsys backend to use instead of letting automatically select a backend.
if you select an unsupported backend then Renderer::connect
will fail and report an error.
This may only be called on an un-connected Renderer
.
winsys_id
An ID of the winsys you explicitly want to use.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl UnwindSafe for Renderer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.