mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.55k stars 260 forks source link

uniform float dtime; #21

Open dashxdr opened 11 years ago

dashxdr commented 11 years ago

I'd like to have the time delta passed in (time from last frame). If a shader makes use of the backbuffer it ought to know the time it was rendered. As it is it's impossible to abstract away the framerate from computations.

This comes up in this shader: http://glsl.heroku.com/e#7185.30 If I had faster framerate I'd want the smaller copies moving off into the distance to take a smaller step.

Also I'd love an fps display, it would help greatly in tuning code for efficiency.

dbtx commented 10 years ago

I think that does it for the uniform, it's only tested via file:/// but seems to work, hope I didn't really miss something. now for the FPS...

OK I added a button showing fps once a second and an smoothed delta time to be shown there, but it's not perfect... mainly, when you're minimized or off tab or off screen for some seconds, those values get huge and that throws it way off, though briefly. I bet it can be handled but I haven't had any grand ideas yet about how.