JuliaGL / GLVisualize.jl

Visualization library written in Julia and OpenGL
Other
247 stars 34 forks source link

GUI: play/pause and time sliders #173

Closed loicspace closed 7 years ago

loicspace commented 7 years ago

Hi,

Within the same context as #172 , I am now trying to add interactivity, essentially, the option to pause/play the animation, and ideally, a play slider to render the window at any user defined time value. I have looked at the GUI examples and the source code for button.jl and I think the functions/objects I need are playbutton, play_slider I essentially have a timesignal, e.g. loop(linspace(...)) and some colored surface, particles, lines that are animated/rendered through time signal, of the form:

colo = map(gen_col_inst, timesignal) covt = visualize((lon, lat, zeros(lat)),:surface,color=colo, light=light) _view(covt, window, camera=:perspective)

I am not sure however how to use the playbutton or play_slider. I gather that play_v, play_s = playbutton(...) returns both an object to be rendered (play_v) and signal (boolean signal it seems? -- play_s), what I am missing is how to incorporate that with timesignal or elsewhere to effectively pause/play the rendering.

Thanks! and hopefully this makes sense...let me know if not!

Loic

timholy commented 7 years ago

You might be able to use the player widget in GtkReactive, passing in as an argument the timesignal that GLVisualize sets up. The widget would be in a different window, of course, but as long as you can live with that it might be an easy solution.

SimonDanisch commented 7 years ago

There was actually a bug in the playslider code -.- Guess that happens if you don't test features. I updated it and added a usage example:

https://github.com/JuliaGL/GLVisualize.jl/blob/master/examples/gui/playslider.jl

Make sure to be on master of GLVisualize/GLWindow/GLAbstraction/Reactive

Admittedly, the API for placing the resulting visualizable etc is pretty horrible right now...

loicspace commented 7 years ago

@timholy Thanks for reply! That could work but it seems Simon already jumped on it.

@SimonDanisch Great, thanks! I haven't implemented in my code yet but the example looks exactly like what I want! This is awesome.

I have a couple bigger picture questions, but feel free to close this:

Thanks again!

SimonDanisch commented 7 years ago

GLPlot is a superset of GLVisualize! It's supposed to offer a fairly simple UI for easy exploration of the parameters of your visualization and simply add sliders etc... glplot directly maps to visualize, while adding the edit menu ;)

loicspace commented 7 years ago

OK - that's what I was hoping but wanted to ask more before going through the rabbit whole. I'll experiment more and build up on it and may ask more later, but if so, I'll go over to the GLPlot repo ;)