Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. "Invalid operation" error in resizeGL after window closed
Forum Updated to NodeBB v4.3 + New Features

"Invalid operation" error in resizeGL after window closed

Scheduled Pinned Locked Moved Unsolved Game Development
3 Posts 1 Posters 865 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 8Observer88 Offline
    8Observer88 Offline
    8Observer8
    wrote on last edited by 8Observer8
    #1
    • 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)
    )
    
    1 Reply Last reply
    0
    • 8Observer88 Offline
      8Observer88 Offline
      8Observer8
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • 8Observer88 Offline
        8Observer88 Offline
        8Observer8
        wrote on last edited by
        #3

        I reported the bug: https://bugreports.qt.io/browse/QTBUG-111016

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved