[Public WebGL] WebGL back buffer contents

Gregg Tavares [email protected]
Mon Jan 25 14:11:12 PST 2010


Something that's not clear to me still is how WebGL knows what's in the
backbuffer.

If I do something like

window.setInterval(drawNextTriangle, 1);

function drawNextTriangle() {
  ctx.drawElements(...);
};

Then what will I see on the screen? Is it defined?

Similarly if I do this

// note these are 2 different canvas elements
ctx2d = canvas2d.getContext("2d");
ctx3d = canvas3d.getContext("3d");

... // setup some 3d stuff

ctx3d.drawElements(..);

// draw the contents of the 3d canvas into the 2d canvas.
ctx2d.drawImage(canvas3d, 0, 0);

Is this defined in the spec? I didn't see it. If it's not there does it need
to be?

And how about this?

// note these are 2 different canvas elements
ctx2d = canvas2d.getContext("2d");
ctx3d = canvas3d.getContext("3d");

... // setup some 3d stuff

ctx3d.drawElements(..);

// draw the contents of the 3d canvas into the 2d canvas.
ctx2d.drawImage(canvas3d, 0, 0);

// Draw the 3d canvas to the 2d canvas 1 second later.
window.setTimeout(function() {
   ctx2d.drawImage(canvas3d, 0, 0);  // should this produce the same results
as the previous drawImage?
}, 1000);


In section 2.2 of the spec it talks about presenting the draw buffer to the
compositor. That doesn't seem to cover the case of drawImage in another
context or canvas.toDataURL();

I posted the 3rd example because section 2.2 of the spec says after
compositing the contents of the backbuffer are undefined which suggests to
me that second drawImage call will have undefined results? Am I
mis-interpreting the spec?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20100125/bebc346a/attachment.html>


More information about the public_webgl mailing list