diff options
author | 2021-08-13 20:05:10 +0700 | |
---|---|---|
committer | 2021-08-13 20:22:49 +0700 | |
commit | f1f58b2a8ad8907337e1d542fa8f17990f053862 (patch) | |
tree | a8bfbb218b2ecf238ce9507fd2a72bf8f23a7f79 /examples/integration_opengl/src/main.rs | |
parent | 956780863646c1c17bc2670789459a4d311388fc (diff) | |
download | iced-f1f58b2a8ad8907337e1d542fa8f17990f053862.tar.gz iced-f1f58b2a8ad8907337e1d542fa8f17990f053862.tar.bz2 iced-f1f58b2a8ad8907337e1d542fa8f17990f053862.zip |
Fix `panic!` warnings in `integration_opengl` example
Diffstat (limited to 'examples/integration_opengl/src/main.rs')
-rw-r--r-- | examples/integration_opengl/src/main.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/integration_opengl/src/main.rs b/examples/integration_opengl/src/main.rs index 925102e3..f80915d2 100644 --- a/examples/integration_opengl/src/main.rs +++ b/examples/integration_opengl/src/main.rs @@ -19,18 +19,23 @@ pub fn main() { env_logger::init(); let (gl, event_loop, windowed_context, shader_version) = { let el = glutin::event_loop::EventLoop::new(); + let wb = glutin::window::WindowBuilder::new() .with_title("OpenGL integration example") .with_inner_size(glutin::dpi::LogicalSize::new(1024.0, 768.0)); + let windowed_context = glutin::ContextBuilder::new() .with_vsync(true) .build_windowed(wb, &el) .unwrap(); + unsafe { let windowed_context = windowed_context.make_current().unwrap(); + let gl = glow::Context::from_loader_function(|s| { windowed_context.get_proc_address(s) as *const _ }); + // Enable auto-conversion from/to sRGB gl.enable(glow::FRAMEBUFFER_SRGB); @@ -40,6 +45,7 @@ pub fn main() { // Disable multisampling by default gl.disable(glow::MULTISAMPLE); + (gl, el, windowed_context, "#version 410") } }; |