diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-07-21 14:15:57 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-07-22 14:49:24 (GMT) |
commit | 3597a5b82610752cf95372a5a5f7b33afc8d30b9 (patch) | |
tree | 4746be0f1b90894e72ab1e630268c5a048d0410c /src/opengl/qgl_x11egl.cpp | |
parent | e2aa651aba89bcc409dd090466b04036277a9a7c (diff) | |
download | Qt-3597a5b82610752cf95372a5a5f7b33afc8d30b9.zip Qt-3597a5b82610752cf95372a5a5f7b33afc8d30b9.tar.gz Qt-3597a5b82610752cf95372a5a5f7b33afc8d30b9.tar.bz2 |
Use texture_from_pixmap on X11 & avoid copies
The patch tries to use texture_from_pixmap extentions on glX to properly
bind an X Pixmap to a texture in QGLContextPrivate::bindTexture(QPixmap,).
Because GL & X have different coordinate systems, the pixmap will be
inverted about the y-axis. The extension does however allow a
GLX_Y_INVERTED_EXT attribute to be set which will bind the pixmap the
correct way up. If the underlying driver doesn't support this,
texture_from_pixmap can't be used for QGLContext::bindTexture, because
that function expects the resulting texture to be the right way up.
However, it can still be used internally by the paint engine for
drawPixmap operations. For these cases, if the pixmap is inverted, the
paint engine can simply invert the texture coords to compensate. This is
why this patch also moves QGLTexture into qgl_p.h.
QGLContextPrivate::bindTexture(QPixmap,) now returns a QGLTexture which
the paint engine can inspect to see if it needs to invert the texture
coords.
Finally, it seems on some (probably all) drivers, deleting an X pixmap
which has been bound to a texture before calling glFinish/swapBuffers
renders garbage. Presumably this is because X deletes the pixmap behind
the driver's back before it's had a chance to use it. To fix this, we
reference all QPixmaps which have been bound to stop them being deleted
and only deref them after we swap the buffer, when they can be safely
deleted.
Reviewed-By: Kim
Diffstat (limited to 'src/opengl/qgl_x11egl.cpp')
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 9db3a30..11131ea 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -469,4 +469,15 @@ void QGLWidgetPrivate::recreateEglSurface(bool force) } } +GLuint QGLContextPrivate::bindTextureFromNativePixmap(const QPixmap& pm, const qint64 key, bool canInvert) +{ + // TODO + return 0; +} + +void QGLTexture::deleteBoundPixmap() +{ + //TODO +} + QT_END_NAMESPACE |