Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-955

PySide2.QtGui.QOpenGLContext.versionFunction(...) returns a QAbstractOpenGLFunctions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.4
    • 5.12.0
    • PySide
    • None
    • ubuntu 18.04
    • Linux/X11
    • 091f488479227c58fd3944d68c48fc7efe223f9e (pyside/pyside-setup/dev) 9df5283e034d24e2339de04b3d61e6b03ff52aca (pyside/pyside-setup/6.0) 4621b1afab446e5171af0f10ab6ae987dc4c6ff7 (pyside/tqtc-pyside-setup/tqtc/lts-5.15)

    Description

      Here's a script to reproduce the bug. Works fine with PyQt5 5.12.

      from PySide2.QtCore import QUrl
      from PySide2.QtQuick import QQuickView
      from PySide2.QtQml import QQmlApplicationEngine
      from PySide2.QtGui import QGuiApplication, QOpenGLVersionProfile, QSurfaceFormat, QVector3D
      
      if __name__ == '__main__':    
          fmt = QSurfaceFormat()
          fmt.setProfile(QSurfaceFormat.CoreProfile)
          fmt.setVersion( 4, 1 )
          fmt.setAlphaBufferSize(8)
          fmt.setStencilBufferSize(8)
          fmt.setDepthBufferSize(24)
          fmt.setOption(QSurfaceFormat.DebugContext)    
      
          profile = QOpenGLVersionProfile()
          profile.setProfile(QSurfaceFormat.CoreProfile)
          profile.setVersion( 4, 1 )
          app = QGuiApplication(sys.argv)
          QSurfaceFormat.setDefaultFormat(fmt)
          view = QQuickView()
          view.setSource( QUrl.fromLocalFile('whatever.qml') )
          view.show()
          QGuiApplication.processEvents()
          gl = view.openglContext().versionFunctions(profile)
          gl.glClearColor(0,0,0,0) #FAILS with AttributeError: 'PySide2.QtGui.QAbstractOpenGLFunctions' object has no attribute 'glClearColor'

      One possible hint, on my machine, _QOpenGLFunctions_4_1_Core.so seems not installed by PySide2 :

      ***:~$ locate QOpenGLFunctions
      
      /home/***/.local/lib/python3.6/site-packages/PyQt5/_QOpenGLFunctions_2_0.so
      
      /home/***/.local/lib/python3.6/site-packages/PyQt5/_QOpenGLFunctions_2_1.so
      
      /home/***/.local/lib/python3.6/site-packages/PyQt5/_QOpenGLFunctions_4_1_Core.so
      
      
      
      

       

      whatever.qml:

      import QtQuick 2.5
      Rectangle
      {
          height: 800
          width: 800
          color: "blue"
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              maxlem Maxime Lemonnier
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: