summaryrefslogtreecommitdiffstats
path: root/vcl/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-10-31 19:19:47 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-10 07:58:39 +0100
commit690de8a3ea41a66aa4cc135200d786c2ef465e30 (patch)
tree3113f7f9819ffeffada97407752a7007e2f88465 /vcl/source
parentuse constructor init list (diff)
downloadcore-690de8a3ea41a66aa4cc135200d786c2ef465e30.tar.gz
core-690de8a3ea41a66aa4cc135200d786c2ef465e30.zip
first step at optional single buffered OpenGL rendering
Change-Id: I064de6ca7d40b8e6e378a01dd39a6cd09f040b68
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index c6ab13c15ac6..59435326fb57 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -36,7 +36,8 @@ OpenGLContext::OpenGLContext():
mpWindow(NULL),
m_pChildWindow(NULL),
mbInitialized(false),
- mbRequestLegacyContext(false)
+ mbRequestLegacyContext(false),
+ mbUseDoubleBufferedRendering(true)
{
}
@@ -71,6 +72,11 @@ void OpenGLContext::requestLegacyContext()
mbRequestLegacyContext = true;
}
+void OpenGLContext::requestSingleBufferedRendering()
+{
+ mbUseDoubleBufferedRendering = false;
+}
+
#if defined( _WIN32 )
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -213,6 +219,7 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat)
// We Support Multisampling On This Hardware.
int iAttributes[] =
{
+ WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
@@ -220,12 +227,14 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat)
WGL_ALPHA_BITS_ARB,8,
WGL_DEPTH_BITS_ARB,24,
WGL_STENCIL_BITS_ARB,0,
- WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,
WGL_SAMPLES_ARB,8,
0,0
};
+ if (!mbUseDoubleBufferedRendering)
+ iAttributes[1] = GL_FALSE;
+
bool bArbMultisampleSupported = true;
// First We Check To See If We Can Get A Pixel Format For 4 Samples
@@ -370,7 +379,7 @@ int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ )
}
#ifdef DBG_UTIL
-GLXFBConfig* getFBConfig(Display* dpy, Window win, int& nBestFBC)
+GLXFBConfig* getFBConfig(Display* dpy, Window win, int& nBestFBC, bool bUseDoubleBufferedRendering)
{
if( dpy == 0 || !glXQueryExtension( dpy, NULL, NULL ) )
return NULL;
@@ -395,6 +404,10 @@ GLXFBConfig* getFBConfig(Display* dpy, Window win, int& nBestFBC)
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
None
};
+
+ if (!bUseDoubleBufferedRendering)
+ visual_attribs[1] = False;
+
int fbCount = 0;
GLXFBConfig* pFBC = glXChooseFBConfig( dpy,
screen,
@@ -530,7 +543,7 @@ bool OpenGLContext::ImplInit()
if (glXCreateContextAttribsARB && !mbRequestLegacyContext)
{
int best_fbc = -1;
- GLXFBConfig* pFBC = getFBConfig(m_aGLWin.dpy, m_aGLWin.win, best_fbc);
+ GLXFBConfig* pFBC = getFBConfig(m_aGLWin.dpy, m_aGLWin.win, best_fbc, mbUseDoubleBufferedRendering);
if (!pFBC)
return false;