rust-windowing/glutin

Can't create a legacy OpenGL context

Closed this issue · 1 comments

Specs

OS: Windows 11
A decent GPU

How to repro

fn main() {
        // Create the window and the event loop
        let event_loop = EventLoop::new();
        let window_builder = WindowBuilder::new();

        // Create the opengl context, make it the current one (selected) and 
        // load its functions from the graphics device into the current process
        let context = glutin::ContextBuilder::new()
            .with_gl(GlRequest::Specific(Api::OpenGl, (2, 1))) // <- the version
            .build_windowed(window_builder, &event_loop)
            .unwrap();
        let context = unsafe { context.make_current().unwrap() };
        if !context.is_current() {
            panic!("Couldn't make the context the currnt");
        }
        gl::load_with(|s| context.get_proc_address(s).cast());
        let version = unsafe {
            std::ffi::CStr::from_ptr(gl::GetString(gl::VERSION) as *const _)
                .to_str().unwrap_or("NOT LOADED")
        };
        println!("OpenGL version: {}", version);
}

Goes back to the latest version (4.6.0 in my case), it lets me use the 3.x versions without issue, 1.x, 2.x impossible

Fixed in #1435. If, not reopen an issue.