summaryrefslogtreecommitdiff
path: root/vcl/source/opengl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-11-13 12:00:59 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-12-11 11:39:55 +0000
commit7bc1f1285e82982b5d900f54f3c6f877517598b8 (patch)
treef055198ff7acfa3cf2fac695186452530d539f19 /vcl/source/opengl
parent93185f720aab0e58564c050ea3518746d8597803 (diff)
tdf#93529 - move to a Mac-like double-buffered OpenGL model.
This moves us to always rendering to an off-screen texture, and then (at idle) blitting this to the screen & swapping buffers. Ideally we should never see any rendering, or flicker again with this approach. Several fixes are included: + avoid multiple OpenGL contexts being created for the same window, created excessive flicker problems. + de-virtualize UseContext - which context we use is less critical. + kill 'mbOffscreen' distinction - all VCL rendering is offscreen. + implement 'doFlush' and high priority idle flushing. + bind stencil buffer for clipping vs. textures - fixing complex clopping when rendering to virtual-devices, and off-screen. + document environment. variables. + use white as default background glClear color, but red or random color for DBGUTIL. Change-Id: I6be08595b6c8deb7e6db0dbd81308b2c97d2b4ff
Diffstat (limited to 'vcl/source/opengl')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 26148a607cff..98be555ba5ad 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -18,6 +18,8 @@
#include <vcl/bmpacc.hxx>
#include <vcl/graph.hxx>
+#include <osl/thread.hxx>
+
#if defined(MACOSX)
#include <premac.h>
#include <AppKit/NSOpenGLView.h>
@@ -1487,6 +1489,14 @@ void OpenGLContext::swapBuffers()
#elif defined( UNX )
glXSwapBuffers(m_aGLWin.dpy, m_aGLWin.win);
#endif
+
+ static bool bSleep = getenv("SAL_GL_SLEEP_ON_SWAP");
+ if (bSleep)
+ {
+ // half a second.
+ TimeValue aSleep( 0, 500*1000*1000 );
+ osl::Thread::wait( aSleep );
+ }
}
void OpenGLContext::sync()