summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglpaintdevice.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2012-11-26 12:57:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-30 18:28:04 +0100
commit6385a182f0f93820c96cf274e50a56492491ee10 (patch)
tree5772f4c8570e620448e3ab7473c9e2df5af4005a /src/opengl/qglpaintdevice.cpp
parent3ee48926e6584b4afeda1fc406d19d7b1a8d6f20 (diff)
Added explicit threading API to QtOpenGL.
Since QtOpenGL/QGLContext is implemented in terms of QtGui/QOpenGLContext which has stricter requirements about how it's supposed to be used, we need to apply these requirements to QGLContext as well. This change adds QGLContext::moveToThread(QThread *) and documents it as a necessity for making a context current on another thread. Also introduces QGLPixelbuffer::context() to access the QGLContext of a pixelbuffer, and made QGLWidget::context() return a non-const QGLContext, since there's no good reason why it shouldn't, and it leads to less const_cast clutter. We could have introduced a backdoor in QOpenGLContext instead, making it loosen its requirements, but that would have made it harder / impossible to fully support threaded OpenGL in all the platforms. Task-number: QTBUG-22560 Change-Id: Ibb6f65f342e7c963e80cc42ab5664c5f1cab30b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/opengl/qglpaintdevice.cpp')
-rw-r--r--src/opengl/qglpaintdevice.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index 5aa125f816..e870e45e15 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -43,6 +43,7 @@
#include <private/qgl_p.h>
#include <private/qglpixelbuffer_p.h>
#include <private/qglframebufferobject_p.h>
+#include <qopenglfunctions.h>
QT_BEGIN_NAMESPACE
@@ -90,7 +91,7 @@ void QGLPaintDevice::beginPaint()
if (m_previousFBO != m_thisFBO) {
ctx->d_ptr->current_fbo = m_thisFBO;
- glBindFramebuffer(GL_FRAMEBUFFER, m_thisFBO);
+ ctx->contextHandle()->functions()->glBindFramebuffer(GL_FRAMEBUFFER, m_thisFBO);
}
// Set the default fbo for the context to m_thisFBO so that
@@ -108,7 +109,7 @@ void QGLPaintDevice::ensureActiveTarget()
if (ctx->d_ptr->current_fbo != m_thisFBO) {
ctx->d_ptr->current_fbo = m_thisFBO;
- glBindFramebuffer(GL_FRAMEBUFFER, m_thisFBO);
+ ctx->contextHandle()->functions()->glBindFramebuffer(GL_FRAMEBUFFER, m_thisFBO);
}
ctx->d_ptr->default_fbo = m_thisFBO;
@@ -120,7 +121,7 @@ void QGLPaintDevice::endPaint()
QGLContext *ctx = context();
if (m_previousFBO != ctx->d_func()->current_fbo) {
ctx->d_ptr->current_fbo = m_previousFBO;
- glBindFramebuffer(GL_FRAMEBUFFER, m_previousFBO);
+ ctx->contextHandle()->functions()->glBindFramebuffer(GL_FRAMEBUFFER, m_previousFBO);
}
ctx->d_ptr->default_fbo = 0;