summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-11-26 08:17:35 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-11-26 15:05:59 (GMT)
commit896c51e4d41a7fee06a1601f1b25746f9f98be88 (patch)
treecac70e587d9f293d9a3b4a86320e7b3fb33cd812 /src/opengl
parent004cd14b84e3683cd92cf01061ee9688990f990c (diff)
downloadQt-896c51e4d41a7fee06a1601f1b25746f9f98be88.zip
Qt-896c51e4d41a7fee06a1601f1b25746f9f98be88.tar.gz
Qt-896c51e4d41a7fee06a1601f1b25746f9f98be88.tar.bz2
Move the Lighthouse specfic api into qpa_qpa.cpp
and ifdef the functions in qgl.h
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp12
-rw-r--r--src/opengl/qgl.h2
-rw-r--r--src/opengl/qgl_qpa.cpp20
3 files changed, 22 insertions, 12 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 5eb4c16..111a3e4 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -3160,18 +3160,6 @@ void QGLContext::setDevice(QPaintDevice *pDev)
}
}
-QGLContext *QGLContext::fromPlatformGLContext(QPlatformGLContext *platformContext)
-{
- if (!platformContext)
- return 0;
- if (platformContext->qGLContextHandle()) {
- return reinterpret_cast<QGLContext *>(platformContext->qGLContextHandle());
- }
- QGLContext *glContext = new QGLContext(platformContext);
- glContext->create();
- return glContext;
-}
-
/*!
\fn bool QGLContext::isValid() const
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index f5e0bd7..ff135fa 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -383,7 +383,9 @@ public:
static const QGLContext* currentContext();
+#ifdef Q_WS_QPA
static QGLContext *fromPlatformGLContext(QPlatformGLContext *platformContext);
+#endif
protected:
virtual bool chooseContext(const QGLContext* shareContext = 0);
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index e997704..d45f246 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -360,4 +360,24 @@ void QGLWidget::setColormap(const QGLColormap & c)
Q_UNUSED(c);
}
+
+QGLContext *QGLContext::fromPlatformGLContext(QPlatformGLContext *platformContext)
+{
+ if (!platformContext)
+ return 0;
+ if (platformContext->qGLContextHandle()) {
+ return reinterpret_cast<QGLContext *>(platformContext->qGLContextHandle());
+ }
+ QGLContext *glContext = new QGLContext(platformContext);
+ //Dont call create on context. This can cause the platformFormat to be set on the widget, which
+ //will cause the platformWindow to be recreated.
+ glContext->d_func()->platformContext->setQGLContextHandle(glContext,qDeleteQGLContext);
+ QGLFormat format = QGLFormat::fromPlatformWindowFormat(platformContext->platformWindowFormat());
+ glContext->d_func()->glFormat = format;
+ glContext->d_func()->valid = true;
+
+ return glContext;
+}
+
+
QT_END_NAMESPACE