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

Re: [Public WebGL] Event on SwapBuffers

I also had this same thought. Effectively, what we want to do is have control over what the compositor is doing. It seems like one thing we can already do is independently change the render resolution and the canvas resolution. In this vein, perhaps CSS shaders are a good place for this?


On Tue, Jan 24, 2012 at 6:01 PM, Ben Vanik <benvanik@google.com> wrote:
Hmm true, although in this case I think all that's desired is to know when something is presented to the screen - meaning that there were writes to the default framebuffer during a JS tick (event/etc).
I'd love to see something like this, even if it were just a debug extension. Something like:

var ext = gl.getExtension('WEBGL_swap_callback');
ext.addPreSwapCallback(function() { console.log('user code done, default fb modified, about to be recomposited'); });

Browsers are *hopefully* already detecting whether the default framebuffer was modified and only recompositing if it was, so having the callback logic be around there shouldn't be difficult.

This would make tools like the Inspector much more reliable, as well as enabling cool scenarios like postprocessing extensions/bookmarklets like Brandon mentions.

On Tue, Jan 24, 2012 at 2:55 PM, Florian Bösch <pyalot@gmail.com> wrote:
On Tue, Jan 24, 2012 at 11:47 PM, Brandon Jones <tojiro@gmail.com> wrote:
Not being terribly familiar with the various browser's code bases I'm not sure if there are any practical matters that would prevent such an API from being implemented, but I'm certain that the development community could make good use of them should they be made available!
When dealing with FBOs you don't have a backbuffer. There can be situations in which an FBO has not finished rendering by the time you want to use it for something, in which case you'd call gl.finish() to block until all previously issued commands have finished, it is then safe to assume the FBO is filled.