Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.3, 5.15.2
-
None
-
PySide2
-
-
adf0babe9b006034ae10ac2df0fc45df6acb8478 (pyside/pyside-setup/dev) 22e51cb9b490edc113b0564c493ece0d6730de64 (pyside/tqtc-pyside-setup/tqtc/lts-5.15) f96e2fc175f073c823d208fbf068ebd621dfb593 (pyside/pyside-setup/6.0)
Description
AttributeError: 'PySide2.QtGui.QOpenGLFunctions' object has no attribute 'glShaderSource'
Furthermore, glShaderSource is also missing in the https://doc.qt.io/qtforpython-5/PySide2/QtGui/QOpenGLFunctions.html
Does anyone use QOpenGLFunctions with PySide2? Because how then you can use it without shaders? It seems that the binding is missing for a long time.
Is there any quick workaround for a missing binding? Ex. add the binding by yourself to the QOpenGLFunctions object. I'm using PySide2.
from OpenGL import GL from PySide2 import QtGui if __name__ == "__main__": app = QtGui.QGuiApplication() off_screen = QtGui.QOffscreenSurface() off_screen.create() if off_screen.isValid(): context = QtGui.QOpenGLContext() if context.create(): context.makeCurrent(off_screen) ### f = QtGui.QOpenGLFunctions(context) shader = f.glCreateShader(GL.GL_VERTEX_SHADER) f.glShaderSource(shader, "") # <-AttributeError f.glCompileShader(shader) ####