From 01b0ea5b7ddc712d7c0649d4c06f5ba12a8585f7 Mon Sep 17 00:00:00 2001 From: Haroon Qureshi Date: Wed, 5 Nov 2025 09:16:44 -0800 Subject: [PATCH] Use webgl backend in emscripten builds. (Also only display the model name if its a file.) PiperOrigin-RevId: 828498906 Change-Id: I7def85992f413b321c115ea63db2af057f5fd372 --- src/experimental/studio/app.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/experimental/studio/app.cc b/src/experimental/studio/app.cc index 93f818ae..f8cad0f4 100644 --- a/src/experimental/studio/app.cc +++ b/src/experimental/studio/app.cc @@ -57,7 +57,9 @@ namespace mujoco::studio { // - async physics static constexpr toolbox::Window::Config kWindowConfig = { -#if defined(USE_FILAMENT_VULKAN) +#ifdef EMSCRIPTEN + .render_config = toolbox::Window::RenderConfig::kFilamentWebGL, +#elif defined(USE_FILAMENT_VULKAN) .render_config = toolbox::Window::RenderConfig::kFilamentVulkan, #elif defined(USE_FILAMENT_OPENGL) .render_config = toolbox::Window::RenderConfig::kFilamentOpenGL, @@ -163,10 +165,11 @@ void App::OnModelLoaded(std::string_view model_file) { tmp_ = UiTempState(); mjv_defaultOption(&vis_options_); ClearProfilerData(); - if (model_file.empty()) { - window_->SetTitle("MuJoCo Studio"); - } else { + if (!model_file.empty() && + (model_file.ends_with(".xml") || model_file.ends_with(".mjb"))) { window_->SetTitle("MuJoCo Studio : " + std::string(model_file)); + } else { + window_->SetTitle("MuJoCo Studio"); } }