glvis
glvis copied to clipboard
Refactoring to remove global state
This PR is intended to split off some of the work from #149 into a somewhat-smaller PR.
- Adds a new class,
GLVisWindow
, which consolidates most of the global state withinaux_vis.cpp
.GLVisWindow
handles creation of theSdlWindow
,VisualizationScene*
, andGLVisCommand
objects from aStreamState
object and/or an array of input streams. - Make
VisualizationScene*
event handlers member functions where possible, removing dependence on global pointers. - Remove most references to global objects from the core glvis library.
- Move handling of multiplexing of
GLVisCommand
and other idle function runs fromSdlWindow
toGLVisWindow
.
I can now build and run the js version but there is at least on thing that isn't working yet. I saw that the CallKeySequence
call was moved from aux_js.cpp:startVisualization
into aux_vis.cpp:InitVisualization
(which is called in aux_js.cpp:startVisualization
) but it doesn't seem to work, when I open ex9 I see this:

Instead of this:

I'll spend some more time debugging.
The JS target seems to work well for me now, I slacked a copy to @tzanio and @kanye-quest so check it out if you want
All other examples from glvis.org/live work for me, but I still get an error with Navier in this branch, e.g. the following run:
./glvis -saved ~/glvis-web/src/data/navier.saved
shows

instead of
