Commit 1b997e68 authored by Thomas Marrinan's avatar Thomas Marrinan

starting to handle webgl context lost


Former-commit-id: fafacf964436c30a788b83e82740ec7973bcee86
parent 8314c4cf
......@@ -68,6 +68,9 @@ var texture_cube = SAGE2_App.extend( {
this.roty = null;
this.resizeEvents = "continuous";
this.webglContextLost = this.webglContextLostMethod.bind(this);
this.webglContextRestored = this.webglContextRestoredMethod.bind(this);
},
init: function(id, width, height, resrc, date) {
......@@ -77,6 +80,9 @@ var texture_cube = SAGE2_App.extend( {
// application specific 'init'
this.initGL();
if(this.gl){
this.element.addEventListener("webglcontextlost", this.webglContextLost, false);
this.element.addEventListener("webglcontextrestored", this.webglContextRestored, false);
this.initShaders();
this.initLighting();
this.initBuffers();
......@@ -112,6 +118,16 @@ var texture_cube = SAGE2_App.extend( {
}
},
webglContextLostMethod: function(event) {
console.log("WebGL Context Lost");
console.log(event);
},
webglContextRestoredMethod: function(event) {
console.log("WebGL Context Restored");
console.log(event);
},
initShaders: function() {
var fragmentShader = this.getShader(shader_fs, "x-shader/x-fragment");
var vertexShader = this.getShader(shader_vs, "x-shader/x-vertex");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment