Implement picture-in-picture mode.

Adds a new window that allows the user to display one or more renders from
the different cameras in the scene.

PiperOrigin-RevId: 856607089
Change-Id: I7268ffd3ef62b9b4d62ce8d004fdbbec92b42af4
This commit is contained in:
Haroon Qureshi
2026-01-15 04:41:34 -08:00
committed by Copybara-Service
parent d816b38f4c
commit c92746641d
8 changed files with 209 additions and 7 deletions
+12 -1
View File
@@ -109,7 +109,7 @@ void Renderer::Render(const mjModel* model, mjData* data,
void Renderer::RenderToTexture(const mjModel* model, mjData* data,
mjvCamera* camera, int width, int height,
std::byte* output) {
if (!initialized_ || last_update_time_ == -1) {
if (!initialized_) {
return;
}
@@ -122,6 +122,17 @@ void Renderer::RenderToTexture(const mjModel* model, mjData* data,
mjr_setBuffer(mjFB_WINDOW, &render_context_);
}
int Renderer::UploadImage(int texture_id, const std::byte* pixels, int width,
int height, int bpp) {
#if defined(USE_CLASSIC_OPENGL)
return 0;
#else
return mjr_uploadGuiImage(texture_id,
reinterpret_cast<const unsigned char*>(pixels),
width, height, bpp, &render_context_);
#endif
}
double Renderer::GetFps() { return fps_; }
} // namespace mujoco::platform