Skip to content

Commit

Permalink
add callback between render and swap (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
aray-openai authored Mar 27, 2019
1 parent a2d1c4b commit a1b6e31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mujoco_py/mjrendercontext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class MjRenderContextWindow(MjRenderContext):

def __init__(self, MjSim sim):
super().__init__(sim, offscreen=False)
self.render_swap_callback = None

assert isinstance(self.opengl_context, GlfwContext), (
"Only GlfwContext supported for windowed rendering")
Expand All @@ -290,4 +291,6 @@ class MjRenderContextWindow(MjRenderContext):

glfw.make_context_current(self.window)
super().render(*glfw.get_framebuffer_size(self.window))
if self.render_swap_callback is not None:
self.render_swap_callback()
glfw.swap_buffers(self.window)

0 comments on commit a1b6e31

Please sign in to comment.