diff options
Diffstat (limited to 'js/lib/drawing')
-rwxr-xr-x | js/lib/drawing/world.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 9e502c3e..4b117242 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -17,7 +17,7 @@ var worldCounter = 0; | |||
17 | // Class GLWorld | 17 | // Class GLWorld |
18 | // Manages display in a canvas | 18 | // Manages display in a canvas |
19 | /////////////////////////////////////////////////////////////////////// | 19 | /////////////////////////////////////////////////////////////////////// |
20 | var World = function GLWorld( canvas, use3D ) { | 20 | var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { |
21 | /////////////////////////////////////////////////////////////////////// | 21 | /////////////////////////////////////////////////////////////////////// |
22 | // Instance variables | 22 | // Instance variables |
23 | /////////////////////////////////////////////////////////////////////// | 23 | /////////////////////////////////////////////////////////////////////// |
@@ -30,7 +30,11 @@ var World = function GLWorld( canvas, use3D ) { | |||
30 | 30 | ||
31 | this._canvas = canvas; | 31 | this._canvas = canvas; |
32 | if (this._useWebGL) { | 32 | if (this._useWebGL) { |
33 | this._glContext = canvas.getContext("experimental-webgl"); | 33 | if(preserveDrawingBuffer) { |
34 | this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true}); | ||
35 | } else { | ||
36 | this._glContext = canvas.getContext("experimental-webgl"); | ||
37 | } | ||
34 | } else { | 38 | } else { |
35 | this._2DContext = canvas.getContext( "2d" ); | 39 | this._2DContext = canvas.getContext( "2d" ); |
36 | } | 40 | } |
@@ -347,20 +351,18 @@ var World = function GLWorld( canvas, use3D ) { | |||
347 | return false; | 351 | return false; |
348 | }; | 352 | }; |
349 | 353 | ||
350 | this.generateUniqueNodeID = function() | 354 | this.generateUniqueNodeID = function() { |
351 | { | ||
352 | var str = "" + this._nodeCounter; | 355 | var str = "" + this._nodeCounter; |
353 | this._nodeCounter++; | 356 | this._nodeCounter++; |
354 | return str; | 357 | return str; |
355 | } | 358 | }; |
356 | 359 | ||
357 | 360 | ||
358 | // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state | 361 | // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state |
359 | // in the case of a procedurally built scene an init state is not needed for loading data | 362 | // in the case of a procedurally built scene an init state is not needed for loading data |
360 | if (this._useWebGL) { | 363 | if (this._useWebGL) { |
361 | rdgeStarted = true; | 364 | rdgeStarted = true; |
362 | var id = this._canvas.getAttribute( "data-RDGE-id" ); | 365 | this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" ); |
363 | this._canvas.rdgeid = id; | ||
364 | g_Engine.registerCanvas(this._canvas, this); | 366 | g_Engine.registerCanvas(this._canvas, this); |
365 | RDGEStart( this._canvas ); | 367 | RDGEStart( this._canvas ); |
366 | this._canvas.task.stop() | 368 | this._canvas.task.stop() |
@@ -680,7 +682,7 @@ World.prototype.render = function() { | |||
680 | var root = this.getGeomRoot(); | 682 | var root = this.getGeomRoot(); |
681 | this.hRender( root ); | 683 | this.hRender( root ); |
682 | } else { | 684 | } else { |
683 | g_Engine.setContext( this._canvas.rdgeId ); | 685 | g_Engine.setContext( this._canvas.rdgeid ); |
684 | //this.draw(); | 686 | //this.draw(); |
685 | this.restartRenderLoop(); | 687 | this.restartRenderLoop(); |
686 | } | 688 | } |