"Invalid operation" error in resizeGL after window closed
Unsolved
Game Development
-
- Window 10 64-bit
- Python 3.8
- PyQt 6.3.0
- PySide 6.3.1
- PyOpenGL 3.1.6
When I close the window, I get an "Invalid operation" error in resizeGL() on the line with the glViewport() function. This happens with PyQt6 and PySide6.
import sys from OpenGL.GL import * from PyQt6.QtCore import Qt from PyQt6.QtOpenGL import QOpenGLWindow from PyQt6.QtWidgets import QApplication class OpenGLWindow(QOpenGLWindow): def __init__(self): super().__init__() def initializeGL(self): glClearColor(0.2, 0.2, 0.2, 1) def resizeGL(self, w, h): glViewport(0, 0, w, h) def paintGL(self): glClear(GL_COLOR_BUFFER_BIT) if __name__ == "__main__": QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseDesktopOpenGL) app = QApplication(sys.argv) w = OpenGLWindow() w.show() sys.exit(app.exec())
Debugging details:
Traceback (most recent call last): File "E:\_Projects\OpenGL\basic-examples\animations\set-swap-interval-opengl21-pyqt6-python\opengl_window.py", line 15, in resizeGL glViewport(0, 0, w, h) File "E:\ProgramFiles\Python\Python38\lib\site-packages\OpenGL\error.py", line 230, in glCheckError raise self._errorClass( OpenGL.error.GLError: GLError( err = 1282, description = b'invalid operation', baseOperation = glViewport, cArguments = (0, 0, 160, 160) )
-
I upgraded from PySide 6.3.1 to PySide 6.4.2 but that didn't fix the issue. I'll try to report a bug here. But I have to study it first.
-
I reported the bug: https://bugreports.qt.io/browse/QTBUG-111016