google-deepmind / google-deepmind/mujoco

Getting the GLFW context of "Simulate" in Python

Open
#2,408 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### The feature, motivation and pitch

Hi, as a follow up to [#766](https://github.com/google-deepmind/mujoco/issues/766) (and also somewhat related to [#965](https://github.com/google-deepmind/mujoco/issues/965)):
I am running mujoco passive viewer via `mujoco.launch_passive` in python (which is a wrapper around mujoco `simulate.cc`). I would like to have access to the GLFW window/ mjrContext so that I can:

- run [mjr_figure](https://mujoco.readthedocs.io/en/stable/APIreference/APIfunctions.html#mjr-figure) to add custom 2D plots to the viewer, which requires access to the mjrContext
- add custom imgui overlays to the mujoco viewer by rendering to the same GLFW context/window
- create/render mjui (e.g. [mjui_render](https://mujoco.readthedocs.io/en/stable/APIreference/APIfunctions.html#mjui-render)) which requires access to mjrContext.

### Alternatives

Currently it seems like the workaround would either be to render everything else in a separately managed glfw window or copy and modify the launch_passive/simulate functionality so that we have access to this?

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.