Tested with OpenSpades 0.1.2 and latest master in Windows 10.
I still get 300+ fps even when r_vsync is set.
Relevant piece of code:
https://github.com/yvt/openspades/blob/b4a3837578cf0c973d931b5dd9c7e1a4ed2e3b19/Sources/Gui/SDLRunner.cpp#L430-L438
"No OpenGL context has been made current" is returned by SDL_GetError() when I used the following code to debug this problem:
if (SDL_GL_SetSwapInterval(r_vsync) != 0) {
SPRaise(SDL_GetError());
}
Perhaps SDL_GL_SetSwapInterval has to be called at a later time?
As a workaround, I'm using cl_fps to limit the FPS to the same as my screen refresh rate.
Moving SDL_GL_SetSwapInterval to right _after_ line 130 in Sources/Gui/SDLGLDevice.cpp fixes the issue.
Now this appear on latest version (macOS)
@tapeo wdym? r_vsync is not working on macOS?
In latest version 0.1.3 even if v-sync setted to 1, I get 200 fps and it cause need cpu. In 0.1.2 version it was ok
looks like it doesn't work on latest version
This is still an issue. Confirmed on macOS Mojave 10.14.3 Beta (18D32a).
It's working fine for me on Manjaro (mesa 18.3.1) with latest master
It's also working fine for me on Windows 10 with 0.1.3.
Maybe it's a bug in macOS's OpenGL implementation that actually requires SDL_GL_SetSwapInterval() to be called _before_ the GL context for it to work? (as it was before 5ec968e)
Fixed on macOS Mojave 10.14.4 (source: https://github.com/glfw/glfw/issues/1337#issuecomment-476482317). It seems that earlier versions had a poorly implemented flush handler (the function called to synchronize the contents of a CoreAnimation layer with an associated OpenGL front buffer).
Most helpful comment
https://github.com/yvt/openspades/blob/b68a17c148358f77de3ba1495db42cfd5abf77b9/Sources/Gui/SDLGLDevice.cpp#L125-L130
Moving
SDL_GL_SetSwapIntervalto right _after_ line 130 inSources/Gui/SDLGLDevice.cppfixes the issue.