mmatl/pyrender

Problem with pyopengl !!!

v-wewei opened this issue · 9 comments

Hi, @mmatl
i seem to always get the problem below,
Traceback (most recent call last):
File "test.py", line 31, in
r = pyrender.OffscreenRenderer(640, 480)
File "/home/v-wewei/anaconda3/envs/sdmaskrcnn/lib/python3.6/site-packages/pyrender/offscreen.py", line 32, in init
self._create()
File "/home/v-wewei/anaconda3/envs/sdmaskrcnn/lib/python3.6/site-packages/pyrender/offscreen.py", line 129, in _create
self._platform.init_context()
File "/home/v-wewei/anaconda3/envs/sdmaskrcnn/lib/python3.6/site-packages/pyrender/platforms.py", line 148, in init_context
EGL_NO_CONTEXT, context_attributes
File "/home/v-wewei/anaconda3/envs/sdmaskrcnn/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 402, in call
return self( *args, **named )
File "/home/v-wewei/anaconda3/envs/sdmaskrcnn/lib/python3.6/site-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 12297,
baseOperation = eglCreateContext,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7ff8c4d6ee18>,
<OpenGL._opaque.EGLConfig_pointer object at 0x7ff8c4d6ed90>,
<OpenGL._opaque.EGLContext_pointer object at 0x7ff8c4da0b70>,
<OpenGL.arrays.lists.c_int_Array_7 object at 0x7ff8af5c9048>,
),
result = <OpenGL._opaque.EGLContext_pointer object at 0x7ff8c4902e18>
)

could you help to give me the solution for this opengl problem?
Thanks advance.

I met this problem too. any solution?

i found this problem cas caused by the mistake when i install the nvidia-driver, reinstall the driver make everything works as expected.

@v-wewei How you install new driver? From run file?

@v-wewei I also met this, are you running the code on a server machine?
And I just don't understand, what mistake can be made installing the nvidia-driver ? :(

@lan786 @MengXinChengXuYuan
i run my program on a local machine , not on a remote server.
i install the nvidia-driver with openGL installed, then i am able to overcome this problem. sorry for so late to reply your question. Also you need to check the version with opengl with cm: "glxinfo | grep OpenGL" for the machine. you can have a try if you miss some of the step above.
Best wish !

lcit commented

I run into this problem on a kubernetes pod running Ubuntu 18.04.5 LTS. I assume Nvidia driver are installed correctly as I can use GPU computation and nvidia-smi.

The error is EGL_BAD_MATCH=12297 and it is thrown by eglCreateContext. This function in my case was called here

self._egl_context = eglCreateContext(

after several attempts I found that the problem was the OpenGL version. For some reason by default the machine was running version 3.3 but pyrender expects version 4.1 as for here:

EGL_CONTEXT_MAJOR_VERSION, 4,

in theory my machine should have access to OpenGL 4.x but the version used is 3.3 (you can check with glxinfo). To fix this I had to use this macro in front of the script to run MESA_GL_VERSION_OVERRIDE=4.1 python code.py

At this point I had another problem. My machine for some reason has GL_MAX_SAMPLES=1 which seems to be the upperbound on the number of samples for multisampling. In pyrender the number of samples is set to 4 in both line 1091 and 1096:

glRenderbufferStorageMultisample(

I had to change these two to 1.

I have no clue why GL_MAX_SAMPLES is just 1. Should be much higher.

@lcit Thanks! it works for me!

@lcit thanks a lot! It works now!

@lcit Thanks for your post! This solved all my issues in order to render over GPU