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

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

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.0
    • Fix Version/s: None
    • Component/s: PySide
    • Labels:
      None
    • Environment:
      ubuntu 18.04
    • Platform/s:
      Linux/X11

      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

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

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews Side Panel

                  Error rendering 'com.meetme.plugins.jira.gerrit-plugin:gerrit-reviews-side-panel'. Please contact your Jira administrators.