summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-10 08:02:18 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-10 08:02:18 +0100
commitea48707a9d13fe94bfe4947aa28d755d19813456 (patch)
tree56b0878ba4c50efcc247de1b8a1aea8c63289d61 /include
parent06a5b619a76c96783ee67bdcfd21f203d3ddb53c (diff)
parent730a3ac2daa9ec5774fc7b9482ed1aa94afab67f (diff)
merge initial work on OpenGL vcl backend
The backend builds on Windows, Linux and OSX but still does not render everything perfectly. Based on this initial framework the remaining improvements can be made incrementally in master. Whether the OpenGL code or the normal code is used depends on the OpenGL configuration variable. It currently defaults to false. Additionally we check during runtime if the requirements for running the OpenGL backend are fulfilled.
Diffstat (limited to 'include')
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx36
-rw-r--r--include/vcl/opengl/OpenGLHelper.hxx16
-rw-r--r--include/vcl/outdev.hxx2
3 files changed, 48 insertions, 6 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 4017923c5464..5ca96020fb4d 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -22,9 +22,12 @@
# include "GL/glxew.h"
# include <postx.h>
#elif defined( _WIN32 )
+#ifndef INCLUDED_PRE_POST_WIN_H
+#define INCLUDED_PRE_POST_WIN_H
# include "prewin.h"
# include "postwin.h"
#endif
+#endif
#if defined( _WIN32 )
#include <GL/glext.h>
@@ -99,14 +102,16 @@ struct GLWindow
#elif defined( IOS )
#elif defined( ANDROID )
#elif defined( UNX )
- Display* dpy;
- int screen;
- Window win;
+ Display* dpy;
+ int screen;
+ Window win;
+ Pixmap pix;
#if defined( GLX_EXT_texture_from_pixmap )
GLXFBConfig fbc;
#endif
XVisualInfo* vi;
GLXContext ctx;
+ GLXPixmap glPix;
bool HasGLXExtension( const char* name ) { return checkExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); }
const char* GLXExtensions;
@@ -117,8 +122,6 @@ struct GLWindow
const GLubyte* GLExtensions;
bool bMultiSampleSupported;
- bool HasGLExtension( const char* name ) { return checkExtension( (const GLubyte*) name, GLExtensions ); }
-
GLWindow()
:
#if defined( _WIN32 )
@@ -134,6 +137,7 @@ struct GLWindow
#endif
vi(NULL),
ctx(0),
+ glPix(0),
GLXExtensions(NULL),
#endif
bpp(0),
@@ -154,10 +158,21 @@ public:
~OpenGLContext();
void requestLegacyContext();
+ void requestSingleBufferedRendering();
+ void requestVirtualDevice();
bool init(vcl::Window* pParent = 0);
bool init(SystemChildWindow* pChildWindow);
+// these methods are for the deep platform layer, don't use them in normal code
+// only in vcl's platform code
+#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
+ bool init(Display* dpy, Window win, int screen);
+ bool init(Display* dpy, Pixmap pix, unsigned int width, unsigned int height, int nScreen);
+#elif defined( _WIN32 )
+ bool init( HDC hDC, HWND hWnd );
+#endif
+
void makeCurrent();
void resetCurrent();
void swapBuffers();
@@ -166,7 +181,7 @@ public:
void setWinPosAndSize(const Point &rPos, const Size& rSize);
void setWinSize(const Size& rSize);
- GLWindow& getOpenGLWindow() { return m_aGLWin;}
+ const GLWindow& getOpenGLWindow() const { return m_aGLWin;}
SystemChildWindow* getChildWindow();
const SystemChildWindow* getChildWindow() const;
@@ -183,8 +198,12 @@ public:
static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
private:
+ SAL_DLLPRIVATE bool InitGLEW();
SAL_DLLPRIVATE bool initWindow();
SAL_DLLPRIVATE bool ImplInit();
+#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
+ SAL_DLLPRIVATE void initGLWindow(Visual* pVisual);
+#endif
#if defined(MACOSX)
NSOpenGLView* getOpenGLView();
@@ -197,6 +216,11 @@ private:
boost::scoped_ptr<SystemChildWindow> m_pChildWindowGC;
bool mbInitialized;
bool mbRequestLegacyContext;
+ bool mbUseDoubleBufferedRendering;
+ bool mbRequestVirtualDevice;
+#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
+ bool mbPixmap; // is a pixmap instead of a window
+#endif
};
#endif
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index 8c04e320d4be..d49f579a5550 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -16,6 +16,12 @@
#include <rtl/ustring.hxx>
+#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
+# include <prex.h>
+# include "GL/glxew.h"
+# include <postx.h>
+#endif
+
class VCLOPENGL_DLLPUBLIC OpenGLHelper
{
public:
@@ -46,6 +52,16 @@ public:
static float getGLVersion();
static void checkGLError(const char* aFile, size_t nLine);
+
+ /**
+ * checks if the system supports all features that are necessary for the OpenGL VCL support
+ */
+ static bool supportsVCLOpenGL();
+
+#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
+ static bool GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rVI);
+ static GLXFBConfig GetPixmapFBConfig( Display* pDisplay, bool& bInverted );
+#endif
};
#define CHECK_GL_ERROR() OpenGLHelper::checkGLError(__FILE__, __LINE__)
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 6beb928cbe9b..80d8576a8612 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -514,6 +514,8 @@ public:
const Point& rSrcPt, const Size& rSrcSize,
sal_uInt16 nFlags = 0 );
+ virtual bool SwapBuffers();
+
protected:
virtual void CopyDeviceArea( SalTwoRect& aPosAry, sal_uInt32 nFlags);