aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11_gl.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-12-17 09:37:34 -0500
committerDavid Robillard <d@drobilla.net>2021-12-17 09:37:34 -0500
commitcea2a9b9f454192bccb1bf0b1f5561d601022d00 (patch)
tree0ecd83fdfdfa0365566b28f6e1d8489957831029 /src/x11_gl.c
parentf43635eae207291bac5e3de1b35f64c3b8629a97 (diff)
downloadpugl-cea2a9b9f454192bccb1bf0b1f5561d601022d00.tar.gz
pugl-cea2a9b9f454192bccb1bf0b1f5561d601022d00.tar.bz2
pugl-cea2a9b9f454192bccb1bf0b1f5561d601022d00.zip
Call glXQueryDrawable() from within the GLX context
This fixes getting the PUGL_SWAP_INTERVAL hint on some NVidia drivers.
Diffstat (limited to 'src/x11_gl.c')
-rw-r--r--src/x11_gl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/x11_gl.c b/src/x11_gl.c
index 80eb448..fa5739e 100644
--- a/src/x11_gl.c
+++ b/src/x11_gl.c
@@ -182,12 +182,20 @@ puglX11GlCreate(PuglView* view)
(PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress(
(const uint8_t*)"glXSwapIntervalEXT");
+ // Note that some drivers (NVidia) require the context to be entered here
puglX11GlEnter(view, NULL);
// Set the swap interval if the user requested a specific value
if (view->hints[PUGL_SWAP_INTERVAL] != PUGL_DONT_CARE) {
glXSwapIntervalEXT(display, impl->win, view->hints[PUGL_SWAP_INTERVAL]);
}
+
+ // Get the actual current swap interval
+ glXQueryDrawable(impl->display,
+ impl->win,
+ GLX_SWAP_INTERVAL_EXT,
+ (unsigned int*)&view->hints[PUGL_SWAP_INTERVAL]);
+
puglX11GlLeave(view, NULL);
}
@@ -196,11 +204,6 @@ puglX11GlCreate(PuglView* view)
GLX_DOUBLEBUFFER,
&view->hints[PUGL_DOUBLE_BUFFER]);
- glXQueryDrawable(display,
- impl->win,
- GLX_SWAP_INTERVAL_EXT,
- (unsigned int*)&view->hints[PUGL_SWAP_INTERVAL]);
-
return PUGL_SUCCESS;
}