I realize requestAnimFrame will throttle the app when a tab is switched, but how do you throttle WebGL apps when the browser is in the background but the tab isn't or when the browser is minimized? I'm routinely seeing my battery die because I left a WebGL app running in the browser but it's covered over by windows. Windows has a DX test for whether a window is obscured, but I'm looking for simpler data that the browser isn't the foreground process.
--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I realize requestAnimFrame will throttle the app when a tab is switched, but how do you throttle WebGL apps when the browser is in the background but the tab isn't or when the browser is minimized? I'm routinely seeing my battery die because I left a WebGL app running in the browser but it's covered over by windows. Windows has a DX test for whether a window is obscured, but I'm looking for simpler data that the browser isn't the foreground process.
--
I should add that it feels like requestAnimFrame could offer the app an opportunity to throttle down it's update rate if it detected the browser was put in the background or minimized).
Yes. I was about to suggest something similar.
The browser simply not calling the rAF callback when the tab is
not visible or the browser is backgrounded would probably work for
the majority of applications. We could add an optional
dontCallWhenHidden flag to rAF for applications to request this.
Applications doing simulations could either always be called by
rAF or could run their simulations from an interval timer and set
the new flag.
Applications composing an image in the canvas over multiple
frames would want to be called regardless of hidden status.
For applications doing off-screen drawing it is not clear to me
that rAF is the right thing to use in the first place.
Regards
-Mark
NOTE: This electronic mail message may contain confidential and privileged information from HI Corporation. If you are not the intended recipient, any disclosure, photocopying, distribution or use of the contents of the received information is prohibited. If you have received this e-mail in error, please notify the sender immediately and permanently delete this message and all related copies.