Last active
December 30, 2015 04:59
-
-
Save EdPoole/7779812 to your computer and use it in GitHub Desktop.
Web Graphics Vision
This file contains hidden or 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
function startup() { | |
canvas = document.getElementById("canvas"); | |
canvas = WebGLDebugUtils.makeLostContextSimulatingCanvas(canvas); | |
canvas.addEventListener('webglcontextlost', handleContextLost, false); | |
canvas.addEventListener('webglcontextrestored', handleContextRestored, false); | |
window.addEventListener('mousedown', function() { | |
canvas.loseContext(); | |
}); | |
gl = createGLContext(canvas); | |
console.log(gl); | |
setupShaders(); | |
setupBuffers(); | |
setupTextures(); | |
gl.clearColor(0.0, 0.0, 0.0, 1.0); | |
gl.enable(gl.DEPTH_TEST); | |
draw(); | |
} |
This file contains hidden or 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
function startup() { | |
canvas = document.getElementById("canvas"); | |
canvas = WebGLDebugUtils.makeLostContextSimulatingCanvas(canvas); | |
canvas.addEventListener('webglcontextlost', handleContextLost, false); | |
canvas.addEventListener('webglcontextrestored', handleContextRestored, false); | |
document.addEventListener('keydown', handleKeyDown, false); | |
document.addEventListener('keyup', handleKeyUp, false); | |
canvas.addEventListener('mousemove', mymousemove, false); | |
canvas.addEventListener('mousedown', mymousedown, false); | |
canvas.addEventListener('mouseup', mymouseup, false); | |
canvas.addEventListener('mousewheel', wheelHandler, false); | |
canvas.addEventListener('DOMMouseScroll', wheelHandler, false); | |
gl = createGLContext(canvas); | |
console.log(gl); | |
init(); | |
pwgl.fpsCounter = document.getElementById("fps"); | |
// Draw the complete scene | |
draw(); | |
} |
Yeah, startup looks good. The problem I had was that it was drawing fine, but the box that's supposed to be on top of the table was way off (like 1000 off), so couldn't see it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sidenote, but i've found console.logging lags my machine like crazy (if you're logging in the draw loop that is)