rust-windowing / glutin

A low-level library for OpenGL context creation, written in pure Rust.
Apache License 2.0
1.98k stars 474 forks source link

Enabling v-sync doesn't work on X11 but works on Wayland #1676

Open DragonSWDev opened 4 months ago

DragonSWDev commented 4 months ago

Hello, so basically after creating window surface and context from display I'm enabling or disabling v-sync based on flag passed to the function. Code looks like this:

match vsync_enabled {
            false => gl_surface.set_swap_interval(&gl_context, glutin::surface::SwapInterval::DontWait).unwrap(),
            true => gl_surface.set_swap_interval(&gl_context, glutin::surface::SwapInterval::Wait(NonZeroU32::new(1).unwrap())).unwrap()
        }

it works as expected on Wayland but doesn't work on X11 where v-sync is always disabled. I'm on Fedora 40 with NVIDIA GPU. "Sync to VBlank" option is enabled in NVIDIA Settings. Other OpenGL applications (e.g. glxgears) are running with FPS blocked to refresh rate. Am I missing something?

kchibisov commented 3 months ago

Are you using EGL or GLX here?

DragonSWDev commented 2 months ago

@kchibisov How can I check this?

kchibisov commented 2 months ago

Print https://docs.rs/glutin/latest/glutin/display/trait.GlDisplay.html#tymethod.version_string .