diff options
Diffstat (limited to 'js/helper-classes/RDGE/GLWorld.js')
-rw-r--r-- | js/helper-classes/RDGE/GLWorld.js | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index afd61c8a..e6e7f466 100644 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js | |||
@@ -151,6 +151,7 @@ function GLWorld( canvas, use3D ) | |||
151 | ctx2 = g_Engine.getContext(); | 151 | ctx2 = g_Engine.getContext(); |
152 | if (ctx1 != ctx2) console.log( "***** different contexts *****" ); | 152 | if (ctx1 != ctx2) console.log( "***** different contexts *****" ); |
153 | this.renderer = ctx1.renderer; | 153 | this.renderer = ctx1.renderer; |
154 | this.renderer._world = this; | ||
154 | 155 | ||
155 | // create a camera, set its perspective, and then point it at the origin | 156 | // create a camera, set its perspective, and then point it at the origin |
156 | var cam = new camera(); | 157 | var cam = new camera(); |
@@ -229,18 +230,24 @@ function GLWorld( canvas, use3D ) | |||
229 | { | 230 | { |
230 | if (this._useWebGL) | 231 | if (this._useWebGL) |
231 | { | 232 | { |
233 | g_Engine.setContext( this._canvas.uuid ); | ||
232 | var ctx = g_Engine.getContext(); | 234 | var ctx = g_Engine.getContext(); |
233 | var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle); | 235 | var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle); |
234 | if (ctx1 != ctx) console.log( "***** different contexts (2) *****" ); | 236 | if (ctx1 != ctx) |
237 | console.log( "***** different contexts (2) *****" ); | ||
235 | var aRenderer = ctx1.renderer; | 238 | var aRenderer = ctx1.renderer; |
236 | var renderer = ctx.renderer; | 239 | var renderer = ctx.renderer; |
237 | if (renderer != aRenderer) console.log( "***** DIFFERENT RENDERERS *****" ); | 240 | if (renderer != aRenderer) |
241 | { | ||
242 | console.log( "***** DIFFERENT RENDERERS *****" ); | ||
243 | renderer = aRenderer; | ||
244 | } | ||
238 | 245 | ||
239 | if (renderer.unloadedTextureCount <= 0) | 246 | if (renderer.unloadedTextureCount <= 0) |
240 | { | 247 | { |
241 | renderer.disableCulling(); | 248 | renderer.disableCulling(); |
249 | //console.log( "GLWorld.draw " + renderer._world._worldCount ); | ||
242 | this.myScene.render(); | 250 | this.myScene.render(); |
243 | console.log( "render" ); | ||
244 | 251 | ||
245 | if (this._firstRender) | 252 | if (this._firstRender) |
246 | { | 253 | { |
@@ -389,7 +396,6 @@ function GLWorld( canvas, use3D ) | |||
389 | rdgeStarted = true; | 396 | rdgeStarted = true; |
390 | 397 | ||
391 | this._canvas.rdgeid = this._canvas.uuid; | 398 | this._canvas.rdgeid = this._canvas.uuid; |
392 | this._canvas.id = this._canvas.uuid; | ||
393 | 399 | ||
394 | g_Engine.registerCanvas(this._canvas, this); | 400 | g_Engine.registerCanvas(this._canvas, this); |
395 | RDGEStart( this._canvas ); | 401 | RDGEStart( this._canvas ); |
@@ -508,16 +514,22 @@ GLWorld.prototype.addObject = function( obj ) | |||
508 | 514 | ||
509 | GLWorld.prototype.restartRenderLoop = function() | 515 | GLWorld.prototype.restartRenderLoop = function() |
510 | { | 516 | { |
511 | console.log( "restartRenderLoop" ); | 517 | //console.log( "restartRenderLoop" ); |
512 | 518 | ||
513 | this._firstRender = true; | 519 | this._firstRender = true; |
514 | this._renderCount = -1; | 520 | this._renderCount = -1; |
515 | if (this._canvas.task) | 521 | if (this._canvas.task) |
516 | { | 522 | { |
517 | if (this._allMapsLoaded) | 523 | if (this._allMapsLoaded) |
524 | { | ||
525 | //console.log( "starting task" ); | ||
518 | this._canvas.task.start(); | 526 | this._canvas.task.start(); |
527 | } | ||
519 | else | 528 | else |
529 | { | ||
530 | //console.log( "stopping task" ); | ||
520 | this._canvas.task.stop(); | 531 | this._canvas.task.stop(); |
532 | } | ||
521 | } | 533 | } |
522 | } | 534 | } |
523 | 535 | ||
@@ -757,7 +769,10 @@ GLWorld.prototype.render = function() | |||
757 | } | 769 | } |
758 | else | 770 | else |
759 | { | 771 | { |
760 | this.draw(); | 772 | console.log( "GLWorld.render, " + this._worldCount ); |
773 | g_Engine.setContext( this._canvas.uuid ); | ||
774 | //this.draw(); | ||
775 | this.restartRenderLoop(); | ||
761 | } | 776 | } |
762 | } | 777 | } |
763 | 778 | ||