jonwright / pyopengltk

OpenGL frame for Python/Tkinter via ctypes and pyopengl
MIT License
54 stars 13 forks source link

shader_example freezes when restoring tkinter window #29

Closed fishymonarch closed 2 years ago

fishymonarch commented 2 years ago

I get the following error when restoring the window:

File "shader_example.py", line 137, in redraw GL.glUseProgram(self.shader) File "src\errorchecker.pyx", line 58, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError OpenGL.error.GLError: GLError( err = 1281, description = b'invalid value', base operation = glUseProgram, cArguments = (3,) )

jonwright commented 2 years ago

Thanks - I can reproduce. A full stack dump is:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\wright\Anaconda3\envs\py39\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\Users\wright\Anaconda3\envs\py39\lib\tkinter\__init__.py", line 814, in callit
    func(*args)
  File "C:\Users\wright\Anaconda3\envs\py39\lib\site-packages\pyopengltk\base.py", line 98, in _display
    self.redraw()
  File "C:\Users\wright\Work Folders\Documents\programming\github\jonwright\pyopengltk\examples\shader_example.py", line 137, in redraw
    GL.glUseProgram(self.shader)
  File "C:\Users\wright\Anaconda3\envs\py39\lib\site-packages\OpenGL\error.py", line 230, in glCheckError
    raise self._errorClass(
OpenGL.error.GLError: GLError(
        err = 1281,
        description = b'invalid value',
        baseOperation = glUseProgram,
        cArguments = (3,)
)
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\wright\Anaconda3\envs\py39\lib\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "C:\Users\wright\Anaconda3\envs\py39\lib\site-packages\pyopengltk\base.py", line 74, in tkExpose
    self._display()
  File "C:\Users\wright\Anaconda3\envs\py39\lib\site-packages\pyopengltk\base.py", line 98, in _display
    self.redraw()
  File "C:\Users\wright\Work Folders\Documents\programming\github\jonwright\pyopengltk\examples\shader_example.py", line 137, in redraw
    GL.glUseProgram(self.shader)
  File "C:\Users\wright\Anaconda3\envs\py39\lib\site-packages\OpenGL\error.py", line 230, in glCheckError
    raise self._errorClass(
OpenGL.error.GLError: GLError(
        err = 1281,
        description = b'invalid value',
        baseOperation = glUseProgram,
        cArguments = (3,)
)
jonwright commented 2 years ago

I just pushed a patch to master that might fix this as well as trying to address #25 - can you try from git and let me know if that fixes it for you too?

fishymonarch commented 2 years ago

The patch fixed the issue for me as well.

ThenTech commented 2 years ago

I can also confirm that this fixes the same error I had in https://github.com/vispy/vispy/issues/1993. It was the only thing I could not fix when I added the Tkinter backend for VisPy.

jonwright commented 2 years ago

Thanks for the feedback - this should be fixed and there is now a v0.0.4 on pypi