mcfletch / pyopengl

Repository for the PyOpenGL Project
Other
314 stars 97 forks source link

In a headless environment with no display, I got this error because it checked with GetCurrentContext instead of eglGetCurrentContext. #113

Open M-mckim opened 7 months ago

M-mckim commented 7 months ago

I'm using a headless environment with no display. I create a context with eglCreateContext and bind it with eglMakeCurrent. After that, I use the context in the opengl es environment to do opengl tasks, but pyopengl keeps checking the context with GetCurrentContext(). eglGetCurrentContext() gets the context, but GetCurrentContext() only gets the value None, so I keep getting an error. Do I need something more?

GL Context <OpenGL._opaque.EGLContext_pointer object at 0x7f7f5af2f940> Traceback (most recent call last): File "/lvmdata/mckim/Eagle/nvidia_hdless_opengl.py", line 136, in glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 24, ctypes.c_void_p(0)) File "src/latebind.pyx", line 51, in OpenGL_accelerate.latebind.Curry.call File "/lvmdata/mckim/anaconda3/envs/headless_opengl/lib/python3.9/site-packages/OpenGL/GLES2/VERSION/GLES2_2_0.py", line 444, in glVertexAttribPointer contextdata.setValue( key, array ) File "/lvmdata/mckim/anaconda3/envs/headless_opengl/lib/python3.9/site-packages/OpenGL/contextdata.py", line 58, in setValue context = getContext( context ) File "/lvmdata/mckim/anaconda3/envs/headless_opengl/lib/python3.9/site-packages/OpenGL/contextdata.py", line 40, in getContext raise error.Error( OpenGL.error.Error: Attempt to retrieve context when no valid context