Fix WebGL rendering for the webdemo

PiperOrigin-RevId: 840640628
Change-Id: I4bac3bf634e66da01174927bf6096bc1df642e10
This commit is contained in:
Matija Kecman
2025-12-05 02:38:52 -08:00
committed by Copybara-Service
parent 4e84671a15
commit e93786c161
2 changed files with 5 additions and 0 deletions
@@ -161,8 +161,10 @@ void FilamentContext::Render(const mjrRect& viewport, const mjvScene* scene,
if (!render_to_texture_) {
filament::View* view = scene_view_->PrepareRenderView(last_render_mode_);
#ifndef __EMSCRIPTEN__
// Wait until previous frame is completed before requesting a new frame.
engine_->flushAndWait();
#endif
if (renderer_->beginFrame(swap_chain_)) {
renderer_->render(view);
@@ -289,7 +289,10 @@ void SceneView::PrepareLights() {
params.spot_cone_angle = model->light_cutoff[i];
}
auto light_obj = std::make_unique<Light>(object_mgr_, params);
#ifndef __EMSCRIPTEN__
// TODO(b/458045799): Re-enable when lights work on glinux and chromebook.
light_obj->AddToScene(scene_);
#endif
lights_.emplace_back(std::move(light_obj));
}
}