diff options
author | 2021-12-15 02:07:13 -0300 | |
---|---|---|
committer | 2022-01-19 17:40:17 -0300 | |
commit | 230db88fb2d9454eb13bc4e260723f57f6c4dabe (patch) | |
tree | 5c84f48fe537be6182c8f1599c15b14e5c4305f0 /glutin/src | |
parent | 46fb27b104fda99640cca625934ababeca8fd19a (diff) | |
download | iced-230db88fb2d9454eb13bc4e260723f57f6c4dabe.tar.gz iced-230db88fb2d9454eb13bc4e260723f57f6c4dabe.tar.bz2 iced-230db88fb2d9454eb13bc4e260723f57f6c4dabe.zip |
Add setting to try OpenGL ES first
Diffstat (limited to 'glutin/src')
-rw-r--r-- | glutin/src/application.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 88e67220..27a932fc 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -61,11 +61,23 @@ where settings.id, ); - let context = ContextBuilder::new() + let opengl_builder = ContextBuilder::new() .with_vsync(true) - // .with_gl(glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (2, 0))) - .with_multisampling(C::sample_count(&compositor_settings) as u16) - .build_windowed(builder, &event_loop) + .with_multisampling(C::sample_count(&compositor_settings) as u16); + + let opengles_builder = opengl_builder.clone().with_gl( + glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (2, 0)), + ); + + let (first_builder, second_builder) = if settings.try_opengles_first { + (opengles_builder, opengl_builder) + } else { + (opengl_builder, opengles_builder) + }; + + let context = first_builder + .build_windowed(builder.clone(), &event_loop) + .or_else(|_| second_builder.build_windowed(builder, &event_loop)) .map_err(|error| { use glutin::CreationError; |