src/opengl/qgl_x11.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/src/opengl/qgl_x11.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/opengl/qgl_x11.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -1671,20 +1671,28 @@
 #endif //defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
 
 
-QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, const qint64 key,
+QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, const qint64 key,
                                                            QGLContext::BindOptions options)
 {
 #if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX)
     return 0;
 #else
+
+    // Check we have GLX 1.3, as it is needed for glXCreatePixmap & glXDestroyPixmap
+    int majorVersion = 0;
+    int minorVersion = 0;
+    glXQueryVersion(X11->display, &majorVersion, &minorVersion);
+    if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 3))
+        return 0;
+
     Q_Q(QGLContext);
 
-    Q_ASSERT(pmd->classId() == QPixmapData::X11Class);
+    QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data());
+    Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class);
 
     if (!qt_resolveTextureFromPixmap(paintDevice))
         return 0;
 
-    QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
     const QX11Info &x11Info = pixmapData->xinfo;
 
     // Store the configs (Can be static because configs aren't dependent on current context)
@@ -1753,7 +1761,7 @@
         if (!glxPixmap)
             return 0;
 
-        pixmapData->gl_surface = (Qt::HANDLE)glxPixmap;
+        pixmapData->gl_surface = (void*)glxPixmap;
 
         // Make sure the cleanup hook gets called so we can delete the glx pixmap
         QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData);