OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <span id="description" style="color: white"> |
| 5 Everything is same to draw-webgl-to-canvas-2d.html except for calling |
| 6 redundant toDataURL(). |
| 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. |
| 10 </span> |
| 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> |
| 17 <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(); |
| 27 |
| 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', {'preserveDrawingB
uffer': false}); |
| 35 nonpreserve_canvas3D.toDataURL(); |
| 36 } |
| 37 </script> |
| 38 </body> |
| 39 </html> |
OLD | NEW |