jarcode-foss / glava

GLava - OpenGL audio spectrum visualizer
GNU General Public License v3.0
1.17k stars 59 forks source link

Implemented time uniform for standalone animations #121

Closed faazuthnar closed 5 years ago

faazuthnar commented 5 years ago

This is useful for animating stuff not depending on audio for additional visualizations.

This closes my issue: #120

coderobe commented 5 years ago

Hmm, could this deprecate tcounter which is currently only used to figure out when a second has passed? Given that the semantics of both are similar, minus the 1-second-reset

faazuthnar commented 5 years ago

Now, I removed time, which was a confusing name. Instead I made fcounter not reset every second, and added fcounter_last, which stores the last frame since the last second or so. I think it makes more sense this way.

coderobe commented 5 years ago

fcounter is a frame counter, and thus varies by framerate and framerate stability - what's the use of using this as a measure of time, when it will be inconsistent without vsync (and even with vsync under adaptive refresh scenarios potentially)?

You're also casting fcounter (int) to GLfloat now, that can't be right.

coderobe commented 5 years ago

Now i also just noticed that your initial commit had similar semantics regarding counting frames instead of realtime. I thought you wanted a measure of time passed? While framecounters can be used to advance animations & scenes, you will end up with speedups/slowdowns relative to your reference speed on other devices. I think you want a realtime counter.

faazuthnar commented 5 years ago

Alright, I was rushed, I'll look into it further. Thanks

jarcode-foss commented 5 years ago

Since this feature is required to implement some visualizer effects that have animations that are not strictly tied to FFT output I will be merging this, but only a variation of the initial commit as it's much cleaner and is not bound to a certain period.

jarcode-foss commented 5 years ago

The above commit adds/changes: