Last active
January 4, 2018 19:02
-
-
Save jhollingworth/f9bae6a65be1f61eadc4c538c5ed983c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<canvas id="canvas" width="1080" height="1080"></canvas> | |
<script type="text/javascript"> | |
var canvas = document.getElementById('canvas'); | |
var gl = canvas.getContext('webgl'); | |
gl.viewportWidth = canvas.width; | |
gl.viewportHeight = canvas.height; | |
gl.clearColor(0.99, 0, 1, 1); | |
gl.clear(gl.COLOR_BUFFER_BIT); | |
fetch('/image', { | |
method: 'POST', | |
headers: { | |
Accept: 'application/json, text/plain, */*', | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ | |
image: canvas.toDataURL('image/jpeg'), | |
}), | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment