8000 ImGui crashing when using OpenGL context 3.2+ even though GPU and driver support 4.6 · Issue #375 · pyimgui/pyimgui · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImGui crashing when using OpenGL context 3.2+ even though GPU and driver support 4.6 #375

Open
aleksandaratanasov opened this issue May 15, 2024 · 0 comments

Comments

@aleksandaratanasov
Copy link

I am trying to check something in my OpenGL application (uses the latest versions of PyGame, PyOpenGL and PyImGui packages) with RenderDoc. However, RenderDoc tells me that my app's OpenGL context is not 3.2+.

I checked my specs using glxinfo

OpenGL version string 4.6.0 NVIDIA 535.171.04

leading to the conclusion that anything 3.x should be fine.

I tried setting up the major and minor version for the OpenGL context

pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MAJOR_VERSION, 3)
pygame.display.gl_set_attribute(pygame.GL_CONTEXT_MINOR_VERSION, 3)

before calling

pygame.display.set_mode(display, pygame.DOUBLEBUF | pygame.OPENGL | pygame.RESIZABLE)

Before doing that, using pygame.display.gl_get_attribute() would return 2.2. The changes were applied and I got 3.3.

However, after I set the version properly ImGUI is crashing with the following error:

Traceback (most recent call last):
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/OpenGL/latebind.py", line 41, in __call__
    return self._finalCall( *args, **named )
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/home/user/Projects/CGI/visualizer/renderer.py", line 353, in <module>
    main(logger, config)
  File "/home/user/Projects/CGI/visualizer/renderer.py", line 248, in main
    gui = GUI(width, height, logger, wireframe_enabled, bbox_enabled, zoom_factor, transl_factor, dataloader)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Projects/CGI/visualizer/Gui.py", line 12, in __init__
    self.impl = PygameRenderer()
                ^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/imgui/integrations/pygame.py", line 14, in __init__
    super(PygameRenderer, self).__init__()
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/imgui/integrations/base.py", line 18, in __init__
    self.refresh_font_texture()
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/imgui/integrations/opengl.py", line 251, in refresh_font_texture
    gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_ALPHA, width, height, 0, gl.GL_ALPHA, gl.GL_UNSIGNED_BYTE, pixels)
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/OpenGL/latebind.py", line 45, in __call__
    return self._finalCall( *args, **named )
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/OpenGL/wrapper.py", line 877, in wrapperCall
    raise err
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/OpenGL/wrapper.py", line 870, in wrapperCall
    result = wrappedOperation( *cArguments )
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/miniconda3/envs/CGI/lib/python3.11/site-packages/OpenGL/error.py", line 228, in glCheckError
    raise GLError(
OpenGL.error.GLError: GLError(
        err = 1281,
        description = b'invalid value',
        baseOperation = glTexImage2D,
        pyArgs = (
                GL_TEXTURE_2D,
                0,
                GL_ALPHA,
                512,
                64,
                0,
                GL_ALPHA,
                GL_UNSIGNED_BYTE,
                b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...,
        ),
        cArgs = (
                GL_TEXTURE_2D,
                0,
                GL_ALPHA,
                512,
                64,
                0,
                GL_ALPHA,
                GL_UNSIGNED_BYTE,
                b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...,
        ),
        cArguments = (
                GL_TEXTURE_2D,
                0,
                GL_ALPHA,
                512,
                64,
                0,
                GL_ALPHA,
                GL_UNSIGNED_BYTE,
                b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...,
    )
)

I was unable to find info right out of the bat regarding the ImGUI integration with PyGame and where a specific version is required.

I played around with the major and minor numbers and I can get ImGUI to work in 3.1. Anything above that leads to a crash. I am unable to find information on OpenGL 3.1 in ImGui's documentation.

Is this fixable? Do I have to build from source to get the latest ImGUI and the Python bindings to work together?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0