Skip to content

Quick and simple GUI for SOFA, based on GLFW and optionally Dear ImGui

License

Notifications You must be signed in to change notification settings

sofa-framework/SofaGLFW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SofaGLFW

Gitter Support

download forks stars

This SOFA plugin brings a simple GUI based on GLFW (a spiritual successor of Glut).

It only needs Sofa.Simulation.Graph, Sofa.Component.Visual, Sofa.GUI.Common and Sofa.GL as dependencies. Integration of GLFW is automatic (automatic fetching and integration with CMake), and linked statically (does not need a glfw.dll to be shipped with)

This GUI is launchable with the standard runSofa (with the parameter "-g glfw"), or can be used with a (provided) stand-alone executable runSofaGLFW (which needs much less dependencies than runSofa)

Lastly, this GUI was designed to support multiple windows in the same time and multiple simulations.

Dependencies

Linux

Unix-like systems such as Linux need a few extra packages for GLFW. Read the documentation on the GLFW website (section Installing dependencies). For example, if you are on Ubuntu running X11, you need to do:

sudo apt install xorg-dev

Others

No dependencies

Compilation

As any plugin, to compile SofaGLFW, follow the instructions on the SOFA documentation website.

Keyboard Shortcuts

  • CTRL+F: switch to fullscreen
  • Escape: close the app
  • Space: play/pause the simulation

Command Line Options

runSofaGLFW accepts the following command line options:

  • -f or --file to specify the scene file to load. If not defined, the default scene file Demos/caduceus.scn is loaded.
  • -a or --start: if true, starts the simulation just after opening. True by default.
  • -s or --fullscreen: set full screen at startup. False by default.
  • -l or --load: load given plugins as a comma-separated list. Example: -l SofaPython3

Dear ImGui

By default, SofaGLFW does not show any user interface. Only the keyboard allows limited interactions with the simulation. That is why a user interface based on Dear ImGui is provided, in the form of a SOFA plugin.

By default, this interface is not compiled. The CMake variable PLUGIN_SOFAIMGUI must be set to ON.

Integration of Dear ImGui is automatic (automatic fetching and integration with CMake), and linked statically.

Dependencies

SofaImGui depends on SofaGLFW, so it must also be activated.

The GUI relies on the NFD-extended library. Therefore, it comes with its dependencies. See the list on GitHub.

Compilation

As any plugin, to compile SofaImGui, follow the instructions on the SOFA documentation website.

Usage

To run SOFA with the GUI from SofaImGui, execute the following command:

runSofa -l SofaImGui -g imgui
  • -l SofaImGui: loads the plugin in order to be able to use the GUI (see the documentation)
  • -g imgui: selects the runSofa GUI to be the one from SofaImGui

It is possible to run the Dear ImGui-based GUI by default when running the command ./runSofa (without the -l and -g arguments). To do so, add the SofaImGui plugin into the list of loaded plugin in the plugin_list.conf file (see the documentation). Then, run runSofa -g imgui at least once so that runSofa save the last used GUI. After that, ./runSofa will load the imgui GUI.

Windows

The GUI is based on dockable windows. Each window gathers related features. Here are all the available windows:

Window Description
Performances display simple metrics related to application performances: ms/frame, FPS, graph
Profiler display detailed metrics related to the physics loop performances
Scene Graph show the scene graph and the Data associated to each components
Display Flags filter which components are rendered in the 3D view
Plugin show a list of plugins currently loaded
Components show a detailed list of components currently loaded
Log all the messages sent by SOFA

Screenshots

MainGUI