potocpav / python-concur

Concur UI Framework for Python
MIT License
49 stars 2 forks source link

OpenGL.error.GLError: GLError - err = 1281 - description = b'invalid value' #32

Closed sla-te closed 1 year ago

sla-te commented 3 years ago

I just got this one, It happened randomly without any special interaction:

  File "C:\Users\user\PycharmProjects\my_app\app.py", line 646, in <module>

  File "C:\Users\user\PycharmProjects\my_app\app.py", line 101, in __init__
    c.main(widget=c.font(self.__initialize_custom_font(), self.run_application(u=self.u, o=self.o)), name=f"My Appv{self.version}", width=1024, height=768, menu_bar=True, fps=60)
  File "C:\Users\user\PycharmProjects\my_app\venv\lib\site-packages\concur\integrations\glfw.py", line 172, in main
    impl.render(imgui.get_draw_data())
  File "C:\Users\user\PycharmProjects\my_app\venv\lib\site-packages\imgui\integrations\opengl.py", line 236, in render
    gl.glScissor(int(x), int(fb_height - w), int(z - x), int(w - y))
  File "C:\Users\user\PycharmProjects\my_app\venv\lib\site-packages\OpenGL\error.py", line 230, in glCheckError
    raise self._errorClass(
OpenGL.error.GLError: GLError(
    err = 1281,
    description = b'invalid value',
    baseOperation = glScissor,
    cArguments = (81, 1, -35, 727)
)

Not sure if that tells you anything and its not something, that happens all the time but I wanted to report it just to be sure.

EDIT: I was able to reproduce it by clicking special buttons on my Mouse Logitech G502 multiple times. Do note, that one of the custom keys will trigger the Windows action to "Show the Desktop", meaning minimize all windows and I believe its related to that, at least it seems like it. EDIT2: As the error seems to be related to OpenGL I opened an issue over there: https://github.com/mcfletch/pyopengl/issues/53

potocpav commented 3 years ago

Thanks for the bug report. I don't know how to solve it without a more precise cause, or a way to reproduce the bug. Somebody is clearly setting an invalid scissor box. GLFW, maybe? I can't find such a code though.

sla-te commented 3 years ago

Take a look at the issue over at GLFW. Is there a way to catch this error in any way, to make sure it just does not happen? Im having trouble to consistently reproduce it myself as well.

potocpav commented 3 years ago

It looks simple to work around. Replace this line with the following to force non-negative scissor box width and height.

gl.glScissor(int(x), int(fb_height - w), max(0, int(z - x)), max(0, int(w - y)))

That said, this is either a bug in ImGui, or ImGui mis-use. Do you do anything suspicious with columns, or child boxes, etc.? Related bug: https://github.com/ocornut/imgui/pull/3475

sla-te commented 3 years ago

I have a lot of selectables and pictures inside columns if you would consider this suspicious :D. Why not make this change default, could it possibly cause any problems?

potocpav commented 3 years ago

Probably not. The only problem is that it's yet another deviation from upstream. Will do, stability is important.