diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 29c96d3ea..0635002e1 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -459,6 +459,13 @@ void SDLGLFB::NewRefreshRate () void SDLGLFB::SwapBuffers() { +#ifndef __APPLE__ + if (vid_maxfps && !cl_capfps) + { + SEMAPHORE_WAIT(FPSLimitSemaphore) + } +#endif + SDL_GL_SwapWindow (Screen); } diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 2edd89631..bec2a19cf 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -1149,6 +1149,11 @@ void Win32GLFrameBuffer::SetVSync (bool vsync) void Win32GLFrameBuffer::SwapBuffers() { + // Limiting the frame rate is as simple as waiting for the timer to signal this event. + if (FPSLimitEvent != NULL) + { + WaitForSingleObject(FPSLimitEvent, 1000); + } ::SwapBuffers(static_cast(Video)->m_hDC); }