We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 41d0c73 commit 7c6085dCopy full SHA for 7c6085d
1 file changed
dm_control/viewer/gui/glfw_gui.py
@@ -290,6 +290,20 @@ def event_loop(self, tick_func):
290
self._mouse.process_events()
291
self._keyboard.process_events()
292
293
+ def update(self, render_func):
294
+ """Updates the window and renders a new image.
295
+
296
+ Args:
297
+ render_func: A callable returning a 3D numpy array of bytes (np.uint8),
298
+ with dimensions (width, height, 3).
299
+ """
300
+ pixels = render_func()
301
+ with self._context.make_current() as ctx:
302
+ ctx.call(
303
+ self._update_gui_on_render_thread, self._context.window, pixels)
304
+ self._mouse.process_events()
305
+ self._keyboard.process_events()
306
307
def _update_gui_on_render_thread(self, window, pixels):
308
self._fullscreen_quad.render(pixels, self.shape)
309
glfw.swap_buffers(window)
0 commit comments