Struct glutin_winit::DisplayBuilder
source · pub struct DisplayBuilder { /* private fields */ }
Expand description
The helper to perform Display
creation and OpenGL platform
bootstrapping with the help of winit
with little to no platform specific
code.
This is only required for the initial setup. If you want to create
additional windows just use the finalize_window
function and the
configuration you’ve used either for the original window or picked with the
existing Display
.
Implementations§
source§impl DisplayBuilder
impl DisplayBuilder
sourcepub fn with_preference(self, preference: ApiPreference) -> Self
pub fn with_preference(self, preference: ApiPreference) -> Self
The preference in picking the configuration.
sourcepub fn with_window_attributes(
self,
window_attributes: Option<WindowAttributes>,
) -> Self
pub fn with_window_attributes( self, window_attributes: Option<WindowAttributes>, ) -> Self
The window attributes to use when building a window.
By default no window is created.
sourcepub fn build<Picker>(
self,
event_loop: &impl GlutinEventLoop,
template_builder: ConfigTemplateBuilder,
config_picker: Picker,
) -> Result<(Option<Window>, Config), Box<dyn Error>>
pub fn build<Picker>( self, event_loop: &impl GlutinEventLoop, template_builder: ConfigTemplateBuilder, config_picker: Picker, ) -> Result<(Option<Window>, Config), Box<dyn Error>>
Initialize the OpenGL platform and create a compatible window to use
with it when the WindowAttributes
was passed with
Self::with_window_attributes()
. It’s optional, since on some
platforms like Android
it is not available early on, so you want to
find configuration and later use it with the finalize_window
.
But if you don’t care about such platform you can always pass
WindowAttributes
.
§Api-specific
WGL: - WindowAttributes
must be passed in
Self::with_window_attributes()
if modern OpenGL(ES) is desired,
otherwise only builtin functions like glClear
will be available.
Trait Implementations§
source§impl Clone for DisplayBuilder
impl Clone for DisplayBuilder
source§fn clone(&self) -> DisplayBuilder
fn clone(&self) -> DisplayBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more