ContextException: requiere la extensión GLX_ARB_create_context para crear contextos OpenGL 3

Este problema ocurre cuando se usa pyrender para renderizar:

ContextException                          Traceback (most recent call last)
/data/opt/AAN/lib/python3.7/site-packages/pyrender/platforms/pyglet_platform.py in init_context(self)
     38                                                 resizable=False,
---> 39                                                 width=1, height=1)
     40         except Exception as e:

/data/opt/AAN/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py in __init__(self, *args, **kwargs)
    172 
--> 173         super(XlibWindow, self).__init__(*args, **kwargs)
    174 

/data/opt/AAN/lib/python3.7/site-packages/pyglet/window/__init__.py in __init__(self, width, height, caption, resizable, style, fullscreen, visible, vsync, file_drops, display, screen, config, context, mode)
    605         if not context:
--> 606             context = config.create_context(gl.current_context)
    607 

/data/opt/AAN/lib/python3.7/site-packages/pyglet/gl/xlib.py in create_context(self, share)
    163     def create_context(self, share):
--> 164         return XlibContext10(self, share)
    165 

/data/opt/AAN/lib/python3.7/site-packages/pyglet/gl/xlib.py in __init__(self, config, share)
    263     def __init__(self, config, share):
--> 264         super(XlibContext10, self).__init__(config, share)
    265 

/data/opt/AAN/lib/python3.7/site-packages/pyglet/gl/xlib.py in __init__(self, config, share)
    214 
--> 215         self.glx_context = self._create_glx_context(share)
    216         if not self.glx_context:

/data/opt/AAN/lib/python3.7/site-packages/pyglet/gl/xlib.py in _create_glx_context(self, share)
    268             raise gl.ContextException(
--> 269                 'Require GLX_ARB_create_context extension to create OpenGL 3 contexts.')
    270 

ContextException: Require GLX_ARB_create_context extension to create OpenGL 3 contexts.

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-6-5f3f7caecb04> in <module>()
      8 
      9 imw, imh=1600, 1600
---> 10 mv = MeshViewer(width=imw, height=imh, use_offscreen=True)

/data/opt/AAN/lib/python3.7/site-packages/human_body_prior/mesh/mesh_viewer.py in __init__(self, width, height, use_offscreen)
     53 
     54         if self.use_offscreen:
---> 55             self.viewer = pyrender.OffscreenRenderer(*self.figsize)
     56             self.use_raymond_lighting(5.)
     57         else:

/data/opt/AAN/lib/python3.7/site-packages/pyrender/offscreen.py in __init__(self, viewport_width, viewport_height, point_size)
     29         self._platform = None
     30         self._renderer = None
---> 31         self._create()
     32 
     33     @property

/data/opt/AAN/lib/python3.7/site-packages/pyrender/offscreen.py in _create(self)
    147                 os.environ['PYOPENGL_PLATFORM']
    148             ))
--> 149         self._platform.init_context()
    150         self._platform.make_current()
    151         self._renderer = Renderer(self.viewport_width, self.viewport_height)

/data/opt/AAN/lib/python3.7/site-packages/pyrender/platforms/pyglet_platform.py in init_context(self)
     43                 'context. If you\'re logged in via SSH, ensure that you\'re '
     44                 'running your script with vglrun (i.e. VirtualGL). The '
---> 45                 'internal error message was "{}"'.format(e)
     46             )
     47 

ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was "Require GLX_ARB_create_context extension to create OpenGL 3 contexts."

Solución:

Agrega el código:

import os
os.environ["PYOPENGL_PLATFORM"] = "egl"

 

Supongo que te gusta

Origin blog.csdn.net/zhou_438/article/details/108648990
Recomendado
Clasificación