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

Re: [Public WebGL] Shared resources between contexts

I'm also interested in shared contexts or multiple render target canvases.  My use case is multiple windows with different views of a globe.  For example, one canvas may have a full world view, while another canvas is zoomed in on an individual aircraft or satellite model; or, there may be two canvases with the same aircraft model viewed from two different angles: from the pilot's perspective and a third-person view.

I'd like to hear more about the multiple render target canvases idea.  However, on desktop OpenGL, multiple contexts are often used with multithreading, so if there is ever a possibility of creating WebGL resources on webworkers, perhaps shared contexts will be necessary.


On Mon, Dec 26, 2011 at 12:06 PM, Glenn Maynard <glenn@zewt.org> wrote:
On Sun, Dec 25, 2011 at 7:02 PM, Rehno Lindeque <rehno.lindeque@gmail.com> wrote:
One other thing that I've come across, more or less in the same vein.
Functions such as these...

  GLboolean isBuffer(WebGLBuffer buffer);
  GLboolean isFramebuffer(WebGLFramebuffer framebuffer);
  GLboolean isProgram(WebGLProgram program);
  GLboolean isRenderbuffer(WebGLRenderbuffer renderbuffer);
  GLboolean isShader(WebGLShader shader);
  GLboolean isTexture(WebGLTexture texture);

...that need to be used with a webgl context, seem to be a little bit
awkward to me.

These are specific to a context, because they return true only if the object is valid in that context.  They return false if you pass an object from one context to another (as well as if the object has been invalidated, etc).

This isn't entirely clear from the specs, since the underlying ES spec for these functions doesn't have any notion of multiple contexts being accessible at once with resources from both being addressable simultaneously, but it's logical and it's how implementations behave.

Gregg, etc: it might help to say "... is valid in this context", to make this detail clear.

Glenn Maynard