From 3d535a3f299e4bc20787032de718b0198ae53bae Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 27 Jun 2019 21:15:57 +0200 Subject: Fix double-buffering --- pugl/pugl_internal_types.h | 2 +- pugl/pugl_x11_gl.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pugl/pugl_internal_types.h b/pugl/pugl_internal_types.h index bbc39c0..839084c 100644 --- a/pugl/pugl_internal_types.h +++ b/pugl/pugl_internal_types.h @@ -39,8 +39,8 @@ typedef struct { int depth_bits; int stencil_bits; int samples; + int double_buffer; bool use_compat_profile; - bool double_buffer; bool resizable; } PuglHints; diff --git a/pugl/pugl_x11_gl.c b/pugl/pugl_x11_gl.c index b1399cc..8f8e4fd 100644 --- a/pugl/pugl_x11_gl.c +++ b/pugl/pugl_x11_gl.c @@ -69,9 +69,7 @@ puglX11GlConfigure(PuglView* view) GLX_ALPHA_SIZE, puglX11GlHintValue(view->hints.alpha_bits), GLX_DEPTH_SIZE, puglX11GlHintValue(view->hints.depth_bits), GLX_STENCIL_SIZE, puglX11GlHintValue(view->hints.stencil_bits), - GLX_DOUBLEBUFFER, (view->hints.samples - ? GLX_DONT_CARE - : view->hints.double_buffer), + GLX_DOUBLEBUFFER, puglX11GlHintValue(view->hints.double_buffer), None }; @@ -162,14 +160,13 @@ puglX11GlLeave(PuglView* view, bool flush) { PuglX11GlSurface* surface = (PuglX11GlSurface*)view->impl->surface; - if (flush) { + if (flush && surface->double_buffered) { + glXSwapBuffers(view->impl->display, view->impl->win); + } else if (flush) { glFlush(); } glXMakeCurrent(view->impl->display, None, NULL); - if (surface->double_buffered) { - glXSwapBuffers(view->impl->display, view->impl->win); - } return 0; } -- cgit v1.2.1