diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 09:17:35 +0100 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 16:05:59 +0100 |
commit | 896c51e4d41a7fee06a1601f1b25746f9f98be88 (patch) | |
tree | cac70e587d9f293d9a3b4a86320e7b3fb33cd812 /src/opengl/qgl_qpa.cpp | |
parent | 004cd14b84e3683cd92cf01061ee9688990f990c (diff) |
Move the Lighthouse specfic api into qpa_qpa.cpp
and ifdef the functions in qgl.h
Diffstat (limited to 'src/opengl/qgl_qpa.cpp')
-rw-r--r-- | src/opengl/qgl_qpa.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index e997704b31..d45f246a12 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 |