Skip to content
Snippets Groups Projects
Commit 41a5fc26 authored by Jerry Tworek's avatar Jerry Tworek
Browse files

Properly terminate glfw.

parent a4aa1b93
No related branches found
No related tags found
No related merge requests found
from threading import Lock
import copy
import glfw
import imageio
import numpy as np
import time
import sys
from mujoco_py.builder import cymj
from mujoco_py.generated import const
import time
import copy
from multiprocessing import Process, Queue
from mujoco_py.utils import rec_copy, rec_assign
import numpy as np
import imageio
from multiprocessing import Process, Queue
from threading import Lock
class MjViewerBasic(cymj.MjRenderContextWindow):
......@@ -49,7 +51,8 @@ class MjViewerBasic(cymj.MjRenderContextWindow):
if self.window is None:
return
elif glfw.window_should_close(self.window):
exit(0)
glfw.terminate()
sys.exit(0)
with self._gui_lock:
super().render()
......@@ -60,7 +63,8 @@ class MjViewerBasic(cymj.MjRenderContextWindow):
if action == glfw.RELEASE and key == glfw.KEY_ESCAPE:
print("Pressed ESC")
print("Quitting.")
exit(0)
glfw.terminate()
sys.exit(0)
def _cursor_pos_callback(self, window, xpos, ypos):
if not (self._button_left_pressed or self._button_right_pressed):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment