diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2012-09-27 15:24:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-03 17:22:03 +0200 |
commit | 394249616cbb4c0861a032d33f846f85e2801677 (patch) | |
tree | d1b7b2b44041be92bbc47f3419866a823ed381c6 /src/plugins/platforms/xcb/qglxintegration.h | |
parent | 84100c9085ddc30368582d02a4229d44622f85e2 (diff) |
OpenGL: Don't request a context version higher than is supported
The function wglCreateContextAttribsARB will fail if we request a
context version higher than is supported. We therefore upper-bound the
requested version by the version of the static context. This results
in context creation succeeding and having the closest possible match
to the requested format.
The xcb qpa plugin is modified to operate similarly to the windows
plugin in that it now creates a "static" context which is used to
limit the versions of contexts requested by the user.
Change-Id: I277ad7cc82edfdf7b9d8502ad921c8175feb1a4a
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qglxintegration.h')
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index f8afb2db77..b8285c965a 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -54,10 +54,23 @@ QT_BEGIN_NAMESPACE +class QOpenGLDefaultContextInfo +{ + Q_DISABLE_COPY(QOpenGLDefaultContextInfo) + QOpenGLDefaultContextInfo(); +public: + static QOpenGLDefaultContextInfo *create(QXcbScreen *screen); + + const QByteArray vendor; + const QByteArray renderer; + QSurfaceFormat format; +}; + + class QGLXContext : public QPlatformOpenGLContext { public: - QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share); + QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share, QOpenGLDefaultContextInfo *defaultContextInfo); ~QGLXContext(); bool makeCurrent(QPlatformSurface *surface); |