From 3ed884a7d23bf349716993650f5ed9b18dc5acae Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Mar 2020 18:31:38 +0100 Subject: X11: Implement PUGL_SWAP_INTERVAL --- pugl/detail/x11_gl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pugl/detail/x11_gl.c b/pugl/detail/x11_gl.c index f8ff5ed..5bd7fac 100644 --- a/pugl/detail/x11_gl.c +++ b/pugl/detail/x11_gl.c @@ -132,6 +132,10 @@ puglX11GlCreate(PuglView* view) (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress( (const uint8_t*)"glXCreateContextAttribsARB"); + PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = + (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddress( + (const uint8_t*)"glXSwapIntervalEXT"); + surface->ctx = create_context(display, fb_config, 0, True, ctx_attrs); if (!surface->ctx) { surface->ctx = @@ -142,6 +146,11 @@ puglX11GlCreate(PuglView* view) return PUGL_CREATE_CONTEXT_FAILED; } + const int swapInterval = view->hints[PUGL_SWAP_INTERVAL]; + if (glXSwapIntervalEXT && swapInterval != PUGL_DONT_CARE) { + glXSwapIntervalEXT(display, impl->win, swapInterval); + } + glXGetConfig(impl->display, impl->vi, GLX_DOUBLEBUFFER, -- cgit v1.2.1