path: root/src/opengl/qgl_p.h
diff options
authorSamuel Rødal <>2012-11-26 12:57:09 +0100
committerThe Qt Project <>2012-11-30 18:28:04 +0100
commit6385a182f0f93820c96cf274e50a56492491ee10 (patch)
tree5772f4c8570e620448e3ab7473c9e2df5af4005a /src/opengl/qgl_p.h
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 <> Reviewed-by: Gunnar Sletta <>
Diffstat (limited to 'src/opengl/qgl_p.h')
1 files changed, 4 insertions, 5 deletions
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index df099ea281..904f3c1a3e 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -380,19 +380,18 @@ class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject
QGLTextureDestroyer() : QObject() {
- qRegisterMetaType<GLuint>();
- connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, GLuint)),
- this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, GLuint)));
+ connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, quint32)),
+ this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, quint32)));
void emitFreeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) {
emit freeTexture(context, boundPixmap, id);
- void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id);
+ void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, quint32 id);
private slots:
- void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) {
+ void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, quint32 id) {
QGLShareContextScope scope(context);
glDeleteTextures(1, &id);