trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

screen capture error

Open edshkim98 opened this issue 4 years ago • 2 comments

Hi, I am trying to follow the example here, to screen capture my mesh data. However, when I run the code, I get an error as follow:

    png = scene.save_image(resolution=[1920, 1080],visible=True)
  File "/home/edshkim98/env/lib/python3.7/site-packages/trimesh/scene/scene.py", line 812, in save_image
    **kwargs)
  File "/home/edshkim98/env/lib/python3.7/site-packages/trimesh/viewer/windowed.py", line 875, in render_scene
    **kwargs)
  File "/home/edshkim98/env/lib/python3.7/site-packages/trimesh/viewer/windowed.py", line 161, in __init__
    caption=caption)
  File "/home/edshkim98/env/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 173, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/edshkim98/env/lib/python3.7/site-packages/pyglet/window/__init__.py", line 585, in __init__
    display = pyglet.canvas.get_display()
  File "/home/edshkim98/env/lib/python3.7/site-packages/pyglet/canvas/__init__.py", line 94, in get_display
    return Display()
  File "/home/edshkim98/env/lib/python3.7/site-packages/pyglet/canvas/xlib.py", line 123, in __init__
    raise NoSuchDisplayException('Cannot connect to "%s"' % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

I checked trimesh.load function correctly loads my mesh data and I can't seem to find the problem. Do you know what could be the reason for this error?

Thank you!

edshkim98 avatar Jan 04 '21 16:01 edshkim98

Hey, pyglet can't connect to a display to get an OpenGL context, which can happen for a lot of reasons. Can you open windows from that terminal (i.e. glxgears)?

mikedh avatar Jan 04 '21 18:01 mikedh

@mikedh Hi thank you for the reply! I am using cloud jupyter on ubuntu 16.04, so I don't think I can open windows from the terminal which might be the reason for the problem. So, is glxgears like a virtual screen or window?

**I've just installed glxgears with sudo apt-get install mesa-utils and tried again, but seems to fail with the same reason. What should I need to install in order to be able to open windows from my terminal? Thank you!

edshkim98 avatar Jan 05 '21 03:01 edshkim98