Skip to content

[GLFW] add feature: write rendered frames - #299

Open
fredroy wants to merge 8 commits into
sofa-framework:masterfrom
fredroy:save_frames
Open

fredroy wants to merge 8 commits into
sofa-framework:masterfrom
fredroy:save_frames

Conversation

@fredroy

@fredroy fredroy commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

based on

This complements nicely #298 and output each frame in a PNG file, like pushing the keystroke v .

This allows to create offline video of simulations through docker, or remotely with ssh on a HPC
It could also be useful for creating regression test of rendering

(missing init, refresh registering object and camera missing)
Render without showing anything on screen, while still calling all the
graphics functions: the window and its OpenGL context are created as
usual, they are simply never mapped on screen (GLFW_VISIBLE hint).

Available as '--offscreen' in runSofaGLFW, and in runSofa with the glfw
and imgui GUIs. SofaGLFWGUI::RegisterGUIParameters() declares it for both
of them: GUIManager declares the parameters of every registered GUI, so
the function guards against a second registration.

Fullscreen is ignored in offscreen mode, and switchFullScreen() (F11) is
refused, since it would map the window.
'-n'/'--nbIter' only stopped the batch GUI; with glfw or imgui the
simulation ran until the window was closed, which made it impossible to
run a bounded simulation while still rendering, e.g. together with
'--offscreen'.

The argument is registered by the batch GUI, and cxxopts refuses a
duplicate, so it is not declared a second time: SofaGLFWGUI keeps the
ArgumentParser given to RegisterGUIParameters and reads the already
parsed value in mainLoop(). Only arguments actually present on the
command line end up in the parse result, hence the simulation keeps
running indefinitely when '-n' is not given. 'infinite' is supported as
in the batch GUI.
The imgui GUI is the glfw one plus interactive widgets, so rendering it
without ever showing the window serves no purpose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant