summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglpaintdevice.cpp
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-10-13 12:21:51 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-10-19 12:56:39 (GMT)
commit0d0cba294980c5fbb26a2fd3e930c94606e93d03 (patch)
treeb48b45dc8f4014d519950b351b6b6680dfc59f04 /src/opengl/qglpaintdevice.cpp
parent22b9079040ae0d4f35781509fa6aea7e38ac47bb (diff)
downloadQt-0d0cba294980c5fbb26a2fd3e930c94606e93d03.zip
Qt-0d0cba294980c5fbb26a2fd3e930c94606e93d03.tar.gz
Qt-0d0cba294980c5fbb26a2fd3e930c94606e93d03.tar.bz2
Add a new QX11GLPixmapData which renders to X pixmaps using GL
Enable it by setting QT_USE_X11GL_PIXMAPS environment variable while using the -graphicssystem opengl
Diffstat (limited to 'src/opengl/qglpaintdevice.cpp')
-rw-r--r--src/opengl/qglpaintdevice.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index e68a4b9..2867de5 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -44,6 +44,9 @@
#include <private/qglpixelbuffer_p.h>
#include <private/qglframebufferobject_p.h>
#include <private/qwindowsurface_gl_p.h>
+#ifdef Q_WS_X11
+#include <private/qpixmapdata_x11gl_p.h>
+#endif
#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
#include <private/qpixmapdata_gl_p.h>
@@ -81,6 +84,7 @@ void QGLPaintDevice::beginPaint()
// explicitly unbind. Otherwise the painting will go into
// the previous FBO instead of to the window.
m_previousFBO = ctx->d_func()->current_fbo;
+
if (m_previousFBO != m_thisFBO) {
ctx->d_ptr->current_fbo = m_thisFBO;
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO);
@@ -186,8 +190,14 @@ QGLPaintDevice* QGLPaintDevice::getDevice(QPaintDevice* pd)
case QInternal::Pixmap: {
#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
QPixmapData* pmd = static_cast<QPixmap*>(pd)->pixmapData();
- Q_ASSERT(pmd->classId() == QPixmapData::OpenGLClass);
- glpd = static_cast<QGLPixmapData*>(pmd)->glDevice();
+ if (pmd->classId() == QPixmapData::OpenGLClass)
+ glpd = static_cast<QGLPixmapData*>(pmd)->glDevice();
+#ifdef Q_WS_X11
+ else if (pmd->classId() == QPixmapData::X11Class)
+ glpd = static_cast<QX11GLPixmapData*>(pmd);
+#endif
+ else
+ qWarning("Pixmap type not supported for GL rendering");
#else
qWarning("Pixmap render targets not supported on OpenGL ES 1.x");
#endif