As for 3.b, you aren't drawing onto the same canvas with two
contexts. It can't be done in WebGL. Period.
It can be done in EGL, and I'm pretty sure in GLX and WGL as
well, by changing the context bound to the surface. There's an
implicit flush which slows things down of course.
If you could have 2 contexts, I can't see any point to keeping
their state synchronized ("synonymous"). You should just use a
single context in that case. In which case the whole discussion
about resource sharing is moot.
On Fri, Jan 6, 2012 at 4:27 PM, Glenn Maynard <email@example.com> wrote:
That's not what you said. You said "multiple contexts for onecanvas". That doesn't mean they share the same OpenGL context, it
means they're completely separate OpenGL contexts that happen to
output to the same canvas. The canvas is just the drawing area on the
page; it's essentially the default framebuffer. I don't know why
you'd want to do that, but it's definitely not possible.
(Not that I really understand what you're saying now. Two contexts
are not "the same". If you have two contexts, then they have separate
state, such as whether GL_BLEND is enabled, regardless of whether
they're sharing resources or not.)
If you're going to split #3 into two separate questions then those questions are:
Q: #3.a "how do I get a synonmyous context?"A: call canvas.getContext
Q: #3.b "how do I draw onto the same canvas with two contexts?"A.1: OpenGL/DirectX have no notion of sharing frontbuffers therefore not possible directlyA.2: If answer #1 is implemented, context the second can do RTT and share this texture with context the first, which falls under the domain of resource sharing to which #1 is the qustion.
Therefore, #3 is either satisfied by other means, or not possible, and what's left is #1 and #2.