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

Re: [Public WebGL] Shared resources between contexts

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.
I would personally expect that something like isBuffer could be used
statically the same way that "Array.isArray" can - perhaps
WebGLRenderingContext.isBuffer or just WebGL.isBuffer.

It feels to me a bit like WebGL needs to make the decision whether to
wall off each context from each other and support multiple canvases
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).

Gregg, I was assuming that your prototype is headed in the direction
of my second scenario? It would involve a bit of book keeping to keep
the OpenGL "state machine" separate for the two contexts... (e.g. for
things like bind*, blend*, clear*, colorMask, clear*, enable /
disable, frontFace, scissor, stencil*, viewport etc). Concerned that
it might have a performance impact?

On Sat, Dec 24, 2011 at 12:50 PM, Mikko Mononen <mikko@tinkercad.com> wrote:
> Hi,
> What do people think about multiple render target canvases vs.
> multiple contexts?
> I wish I could use the same context so that I don't need to pass the
> 'gl' around. Instead I'd love to be able to specify which canvas is
> the current render target without requiring to go through readpixels.
> My use case is a 3D CAD tool (see labs.tinkercad.com) where I have a
> catalog of 3D items, which the user can browse and place in 3D.
> Currently we're rendering the catalog images on server. I wish I could
> do better preview of the objects with animations and stuff, a bit like
> in Spore Editor [1].
> --mikko
> [1] http://www.youtube.com/watch?v=vOOkvcPKdeg
> On Sat, Dec 24, 2011 at 12:12 AM, Rehno Lindeque
> <rehno.lindeque@gmail.com> wrote:
>> Hi all,
>> What is the feeling on the list for making shared resources available to
>> multiple WebGL contexts? Gregg mentions
>> in http://games.greggman.com/game/webgl-techniques-and-performance/ that
>> there's been some interest in doing this in the past but wasn't a priority
>> (at the time). Unfortunately I haven't managed to dig up any previous
>> discussions though.
>> Regards,
>> Rehno
> --
> 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