src/opengl/qgl_x11.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
  1669     return glXBindTexImageEXT && glXReleaseTexImageEXT;
  1669     return glXBindTexImageEXT && glXReleaseTexImageEXT;
  1670 }
  1670 }
  1671 #endif //defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
  1671 #endif //defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX)
  1672 
  1672 
  1673 
  1673 
  1674 QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, const qint64 key,
  1674 QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, const qint64 key,
  1675                                                            QGLContext::BindOptions options)
  1675                                                            QGLContext::BindOptions options)
  1676 {
  1676 {
  1677 #if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX)
  1677 #if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX)
  1678     return 0;
  1678     return 0;
  1679 #else
  1679 #else
       
  1680 
       
  1681     // Check we have GLX 1.3, as it is needed for glXCreatePixmap & glXDestroyPixmap
       
  1682     int majorVersion = 0;
       
  1683     int minorVersion = 0;
       
  1684     glXQueryVersion(X11->display, &majorVersion, &minorVersion);
       
  1685     if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 3))
       
  1686         return 0;
       
  1687 
  1680     Q_Q(QGLContext);
  1688     Q_Q(QGLContext);
  1681 
  1689 
  1682     Q_ASSERT(pmd->classId() == QPixmapData::X11Class);
  1690     QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data());
       
  1691     Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class);
  1683 
  1692 
  1684     if (!qt_resolveTextureFromPixmap(paintDevice))
  1693     if (!qt_resolveTextureFromPixmap(paintDevice))
  1685         return 0;
  1694         return 0;
  1686 
  1695 
  1687     QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
       
  1688     const QX11Info &x11Info = pixmapData->xinfo;
  1696     const QX11Info &x11Info = pixmapData->xinfo;
  1689 
  1697 
  1690     // Store the configs (Can be static because configs aren't dependent on current context)
  1698     // Store the configs (Can be static because configs aren't dependent on current context)
  1691     static GLXFBConfig glxRGBPixmapConfig = 0;
  1699     static GLXFBConfig glxRGBPixmapConfig = 0;
  1692     static bool RGBConfigInverted = false;
  1700     static bool RGBConfigInverted = false;
  1751                                     pixmapData->handle(), pixmapAttribs);
  1759                                     pixmapData->handle(), pixmapAttribs);
  1752 
  1760 
  1753         if (!glxPixmap)
  1761         if (!glxPixmap)
  1754             return 0;
  1762             return 0;
  1755 
  1763 
  1756         pixmapData->gl_surface = (Qt::HANDLE)glxPixmap;
  1764         pixmapData->gl_surface = (void*)glxPixmap;
  1757 
  1765 
  1758         // Make sure the cleanup hook gets called so we can delete the glx pixmap
  1766         // Make sure the cleanup hook gets called so we can delete the glx pixmap
  1759         QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData);
  1767         QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData);
  1760     }
  1768     }
  1761 
  1769