mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 16:28:42 -06:00
prefer gles core
This commit is contained in:
parent
198dfb088e
commit
a5641e0d2e
|
@ -9,7 +9,7 @@ use winit::{
|
||||||
use glium::{Display, Surface, Version, Api};
|
use glium::{Display, Surface, Version, Api};
|
||||||
use glutin::{
|
use glutin::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
context::ContextAttributesBuilder,
|
context::{ContextAttributesBuilder, GlProfile},
|
||||||
surface::{WindowSurface, SurfaceAttributesBuilder},
|
surface::{WindowSurface, SurfaceAttributesBuilder},
|
||||||
display::GetGlDisplay,
|
display::GetGlDisplay,
|
||||||
config::ConfigTemplateBuilder
|
config::ConfigTemplateBuilder
|
||||||
|
@ -91,19 +91,21 @@ impl Renderer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// First we start by opening a new Window
|
let display_builder = DisplayBuilder::new()
|
||||||
let display_builder = DisplayBuilder::new().with_window_builder(Some(wb));
|
.with_window_builder(Some(wb));
|
||||||
|
|
||||||
let config_template_builder = ConfigTemplateBuilder::new()
|
let config_template_builder = ConfigTemplateBuilder::new()
|
||||||
.prefer_hardware_accelerated(Some(true))
|
.prefer_hardware_accelerated(Some(true))
|
||||||
.with_depth_size(24)
|
.with_depth_size(24)
|
||||||
.with_multisampling(settings.msaa.unwrap_or_default())
|
.with_multisampling(settings.msaa.unwrap_or_default());
|
||||||
.with_transparency(false);
|
|
||||||
let (window, gl_config) = display_builder
|
let (window, gl_config) = display_builder
|
||||||
.build(event_loop, config_template_builder, |mut configs| {
|
.build(event_loop, config_template_builder, |mut configs| {
|
||||||
configs.next().unwrap()
|
configs.next().unwrap()
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let window = window.unwrap();
|
|
||||||
|
let window = window.expect("no window");
|
||||||
|
|
||||||
// Now we get the window size to use as the initial size of the Surface
|
// Now we get the window size to use as the initial size of the Surface
|
||||||
let (width, height): (u32, u32) = window.inner_size().into();
|
let (width, height): (u32, u32) = window.inner_size().into();
|
||||||
|
@ -114,11 +116,22 @@ impl Renderer {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Finally we can create a Surface, use it to make a PossiblyCurrentContext and create the glium Display
|
// Finally we can create a Surface, use it to make a PossiblyCurrentContext and create the glium Display
|
||||||
let surface = unsafe { gl_config.display().create_window_surface(&gl_config, &attrs).unwrap() };
|
let surface = unsafe {
|
||||||
let context_attributes = ContextAttributesBuilder::new().build(Some(window.raw_window_handle()));
|
gl_config.display().create_window_surface(&gl_config, &attrs).unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
|
let context_attributes = ContextAttributesBuilder::new()
|
||||||
|
.with_debug(cfg!(debug_assertions))
|
||||||
|
.with_context_api(glutin::context::ContextApi::Gles(None))
|
||||||
|
.with_profile(GlProfile::Core)
|
||||||
|
.build(Some(window.raw_window_handle()));
|
||||||
|
|
||||||
let current_context = unsafe {
|
let current_context = unsafe {
|
||||||
gl_config.display().create_context(&gl_config, &context_attributes).expect("failed to create context")
|
gl_config.display()
|
||||||
|
.create_context(&gl_config, &context_attributes)
|
||||||
|
.expect("failed to create context")
|
||||||
}.make_current(&surface).unwrap();
|
}.make_current(&surface).unwrap();
|
||||||
|
|
||||||
let display = Display::from_context_surface(current_context, surface).unwrap();
|
let display = Display::from_context_surface(current_context, surface).unwrap();
|
||||||
|
|
||||||
//TODO MIGRATION
|
//TODO MIGRATION
|
||||||
|
|
Loading…
Reference in a new issue