Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Simple Software Renderer</title>
- </head>
- <body>
- <canvas width="1280" height="720"></canvas>
- <script type="text/javascript">
- window.onload = function () {
- var ctx = document.getElementsByTagName('canvas')[0].getContext('2d');
- var idx = 0;
- var w = ctx.canvas.width;
- var h = ctx.canvas.height;
- function idxFilename(idx) {
- return '' + '00000000'.slice(('' + idx)['length']) + idx + '.png';
- }
- function handleBlob(blob) {
- var req = new XMLHttpRequest();
- req.open('POST', idxFilename(++idx), true);
- req.onload = handleRequest;
- req.send(blob);
- }
- function handleRequest() {if (draw()) ctx.canvas.toBlob(handleBlob)}
- function draw() {
- //
- }
- handleRequest();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement