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

Re: [Public WebGL] Issues with sharing resources across contexts



Let's make an example, this is how I want to deal with the problem:

gl = createContext();

gl.bindFront(canvas1);
gl.uniform4fv(view);
gl.drawArrays(...);
gl.bindFront(null)

mat4rotatex(90, view);
gl.bindFront(canvas2);
gl.uniform4vf(view);
gl.drawArrays(...)
gl.bindFront(null)

This is how I do not want to have to deal with it:

ctx1 = canvas1.getContext()
ctx2 = canvas2.getContext()
shader = ctx1.createShader(); ...
ctx1.use(shader)
ctx1.acquire(shader)
ctx1.acquire(buffer)
ctx1.uniform4fv(mat4)
ctx1.drawArrays(...)
ctx1.unuse(shader)
release(shader)
release(buffer)

ctx2.acquire(shader)
ctx2.acquire(buffer)
ctx2.useShader(shader)
rotatex(90, view)
ctx2.drawArrays()
ctx2.unbind(buffer)
ctx2.unuse(shader)
ctx2.release(shader)
ctx2.release(buffer)