|
@@ -183,17 +183,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _canvas.addEventListener( 'webglcontextlost', function ( event ) {
|
|
|
-
|
|
|
- event.preventDefault();
|
|
|
-
|
|
|
- resetGLState();
|
|
|
- setDefaultGLState();
|
|
|
-
|
|
|
- objects.clear();
|
|
|
- properties.clear();
|
|
|
-
|
|
|
- }, false );
|
|
|
+ _canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
|
|
|
|
} catch ( error ) {
|
|
|
|
|
@@ -617,8 +607,26 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
this.resetGLState = resetGLState;
|
|
|
|
|
|
+ this.dispose = function() {
|
|
|
+
|
|
|
+ _canvas.removeEventListener( 'webglcontextlost', onContextLost, false );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
// Events
|
|
|
|
|
|
+ function onContextLost( event ) {
|
|
|
+
|
|
|
+ event.preventDefault();
|
|
|
+
|
|
|
+ resetGLState();
|
|
|
+ setDefaultGLState();
|
|
|
+
|
|
|
+ objects.clear();
|
|
|
+ properties.clear();
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
function onTextureDispose( event ) {
|
|
|
|
|
|
var texture = event.target;
|