4 <span id=
"description" style=
"color: white">
5 Everything is same to draw-webgl-to-canvas-
2d.html except for calling
7 Canvas spec allows to call toDataURL() without a context. Some bad things
8 can happen if we call toDataURL() without a context and then create a context
9 and then call toDataURL() again.
11 <canvas id=
"preserve-canvas3d" width=
"100" height=
"100"></canvas>
12 <canvas id=
"preserve-canvas2d" width=
"100" height=
"100"></canvas>
13 <canvas id=
"nonpreserve-canvas3d" width=
"100" height=
"100"></canvas>
14 <canvas id=
"nonpreserve-canvas2d" width=
"100" height=
"100"></canvas>
15 <script src=
"../../../resources/js-test.js"></script>
16 <script src=
"resources/draw-webgl-to-canvas-2d.js"></script>
18 function createContexts() {
19 var preserve_canvas2d
= document
.getElementById("preserve-canvas2d");
20 preserve_canvas2d
.toDataURL();
21 preserve_ctx2D
= preserve_canvas2d
.getContext("2d");
22 preserve_canvas2d
.toDataURL();
23 preserve_canvas3D
= document
.getElementById('preserve-canvas3d');
24 preserve_canvas3D
.toDataURL();
25 preserve_gl
= preserve_canvas3D
.getContext('webgl', {'preserveDrawingBuffer': true});
26 preserve_canvas3D
.toDataURL();
28 var nonpreserve_canvas2d
= document
.getElementById("nonpreserve-canvas2d");
29 nonpreserve_canvas2d
.toDataURL();
30 nonpreserve_ctx2D
= nonpreserve_canvas2d
.getContext("2d");
31 nonpreserve_canvas2d
.toDataURL();
32 nonpreserve_canvas3D
= document
.getElementById('nonpreserve-canvas3d');
33 nonpreserve_canvas3D
.toDataURL();
34 nonpreserve_gl
= nonpreserve_canvas3D
.getContext('webgl', {'preserveDrawingBuffer': false});
35 nonpreserve_canvas3D
.toDataURL();