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

Re: [Public WebGL] Shared resources between contexts



(Sorry for the double reply Florian, I think your original reply
didn't go through to the list...)

On Mon, Dec 26, 2011 at 2:15 AM, Florian Bösch <pyalot@gmail.com> wrote:

>> per context - or - alternatively treat all contexts as views on a
>> single global context and break down the barriers between them while
>> keeping the OpenGL state separate. I tend to be in favour of the
>> second scenario (but purely because it suits my personal use case).

> Not all context on the same page may originate from the purpose to write a
> cohesive application. It is desirable to be able to source in
> application-lets for instance for showcase sites, collaborative tools like
> wikis etc.

I actually agree. However, it's not entirely clear to me whether the
strong separation is actually strictly necessary for these kind of
websites as long as the contexts cannot interfere with each other's
state.

If I could allow myself to switch sides for a moment: I am a little
bit concerned with the book-keeping involved though and also the sense
that the rendering context has become conflated with the target canvas
of the rendering. I could theoretically imagine an API for the first
scenario that goes more like

    var gl = WebGL.createContext(...);
    var rt = WebGL.createRenderTarget(canvas, height, width, bpp, ...);
    gl.setRenderTarget(rt);

or perhaps

    var gl = WebGL.createContext(...);
    var target = WebGL.createDrawingBuffers(....);
    WebGL.bindRenderTarget(canvas, target);
    gl.setRenderTarget(rt);

especially since this would allow multiple contexts to render to the
same render target and still have access to the same drawing buffers
(depth, stencil, color) which is something that I've run into myself.

Unfortunately, I have the feeling that WebGL was not really designed
with this in mind, especially if you look at canvas.getContext and

   WebGLContextAttributes {
       attribute boolean alpha;
       attribute boolean depth;
       attribute boolean stencil;
       attribute boolean antialias;
       attribute boolean premultipliedAlpha;
       attribute boolean preserveDrawingBuffer;
   };

-----------------------------------------------------------
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
-----------------------------------------------------------