diff --git a/client/renderers/opengl.c b/client/renderers/opengl.c index 927bc46d..ac7889ab 100644 --- a/client/renderers/opengl.c +++ b/client/renderers/opengl.c @@ -18,7 +18,6 @@ static PFNGLXGETVIDEOSYNCSGIPROC glXGetVideoSyncSGI = NULL; static PFNGLXWAITVIDEOSYNCSGIPROC glXWaitVideoSyncSGI = NULL; -static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL; struct LGR_OpenGL { @@ -100,9 +99,8 @@ bool lgr_opengl_initialize(void ** opaque, const LG_RendererParams params, const { glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC )glXGetProcAddress((const GLubyte *)"glXGetVideoSyncSGI" ); glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)glXGetProcAddress((const GLubyte *)"glXWaitVideoSyncSGI"); - glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC )glXGetProcAddress((const GLubyte *)"glXSwapIntervalSGI" ); - if (!glXGetVideoSyncSGI || !glXWaitVideoSyncSGI || !glXSwapIntervalSGI) + if (!glXGetVideoSyncSGI || !glXWaitVideoSyncSGI) { glXGetVideoSyncSGI = NULL; DEBUG_ERROR("Failed to get proc addresses"); @@ -212,6 +210,7 @@ bool lgr_opengl_initialize(void ** opaque, const LG_RendererParams params, const this->resizeWindow = true; this->drawStart = nanotime(); + glXGetVideoSyncSGI(&this->gpuFrameCount); // copy the format into the local storage memcpy(&this->format, &format, sizeof(LG_RendererFormat)); @@ -427,14 +426,7 @@ bool lgr_opengl_render(void * opaque, const uint8_t * data, bool resample) // wait until the frame has been presented, this is to avoid the video card // buffering frames, we would rather skip a frame then fall behind the guest - uint count; - glXGetVideoSyncSGI(&count); - if (this->gpuFrameCount == count) - { - uint remainder; - glXWaitVideoSyncSGI(count, 1, &remainder); - } - this->gpuFrameCount = count + 1; + glXWaitVideoSyncSGI(1, 0, &this->gpuFrameCount); const uint64_t t = nanotime(); this->renderTime += t - this->lastFrameTime;