summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qglxintegration.h
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-06-07 17:25:22 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-06-10 09:24:56 +0200
commit4a189c188ccd2fb5f8d1d5ddadf06cbd6bc0916f (patch)
tree99bff9f015e869b5521836ea5667590939b22a53 /src/plugins/platforms/xcb/qglxintegration.h
parent4d10e64f2a78e32418a98e1c80c6579ae0779dfc (diff)
QWindowContext / QWindowFormat refactor.
To enable having a single GL context used for multiple drawables we need to de-couple the context class a bit more from the window class in the plugin API. Now contexts are created stand-alone based on a GL format and a share context, and when calling makeCurrent() a desired surface is specified. This maps well to GLX, EGL, Cocoa, AGL, and WGL, which all support this use case. QWindowContext is renamed to QGuiGLContext, and QWindowFormat is renamed to QGuiGLFormat. We have the ability to introduce a pbuffer or similar other offscreen GL drawable abstraction in the future.
Diffstat (limited to 'src/plugins/platforms/xcb/qglxintegration.h')
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h
index 1760521d47..ae95e23b81 100644
--- a/src/plugins/platforms/xcb/qglxintegration.h
+++ b/src/plugins/platforms/xcb/qglxintegration.h
@@ -45,34 +45,38 @@
#include "qxcbwindow.h"
#include <QtGui/QPlatformGLContext>
-#include <QtGui/QWindowFormat>
+#include <QtGui/QGuiGLFormat>
#include <QtCore/QMutex>
#include <GL/glx.h>
+class QGLXSurface : public QPlatformGLSurface
+{
+public:
+ QGLXSurface(GLXDrawable drawable, const QGuiGLFormat &format);
+ GLXDrawable glxDrawable;
+};
+
class QGLXContext : public QPlatformGLContext
{
public:
- QGLXContext(Window window, QXcbScreen *xd, const QWindowFormat &format);
+ QGLXContext(QXcbScreen *xd, const QGuiGLFormat &format, QPlatformGLContext *share);
~QGLXContext();
- virtual void makeCurrent();
- virtual void doneCurrent();
- virtual void swapBuffers();
- virtual void* getProcAddress(const QString& procName);
+ bool makeCurrent(const QPlatformGLSurface &surface);
+ void doneCurrent();
+ void swapBuffers(const QPlatformGLSurface &surface);
+ void (*getProcAddress(const QByteArray &procName)) ();
- GLXContext glxContext() const { return m_context; }
+ QGuiGLFormat format() const;
- QWindowFormat windowFormat() const;
+ GLXContext glxContext() const { return m_context; }
private:
QXcbScreen *m_screen;
- Drawable m_drawable;
GLXContext m_context;
- QWindowFormat m_windowFormat;
-
- QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context);
+ QGuiGLFormat m_format;
};
#endif