[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Proper way of rendering only when something changes


Rendering not inside of a requestAnimationFrame callback (mousemove, keypress, etc.) should be fine. However, there is probably a snag. Due to some technicalities browsers seem to derive some performance improvment from clearing the backbuffer inbetween rendering frames (traditionally it would exactly be the other way around, it's complicated). So it's possible that your modification to the backbuffer is made before the browser re-composits the webgl canvas (during which it operation it may clear it). You can set the preserveDrawingBuffer flag and see if that helps.


On Fri, Jun 1, 2012 at 7:49 PM, Mikko Mononen <mikko@tinkercad.com> wrote:


Are there some general guidelines how to build a render loop where the
app only draws the scene when something changes? Pretty much all the
samples out there render in an infinite loop.

Our app currently renders only when something changes to save the
precious battery and fans. We're getting increasing amount of reports
from the users using bleeding edge Firefox or Chrome that rendering
does not work for them anymore. If we render stuff with infinite loop
using requestAnimationFrame(), everything works, but once rendering
only when stuff changes, the WenGL canvas is cleared when any element
state changes in DOM, i.e. hover changes element appearance of a

My diagnosis is a bit Chrome specific, but since we're getting similar
reports from FF users too, I'm worried that I'm missing something more


Mikko Mononen, Software Engineer
http://tinkercad.com - Solid modeling for artists & makers

You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl