diff options
Diffstat (limited to 'js/helper-classes/RDGE/GLWorld.js')
-rwxr-xr-x | js/helper-classes/RDGE/GLWorld.js | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index c8327064..1edd5cff 100755 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js | |||
@@ -163,7 +163,7 @@ function GLWorld( canvas, use3D ) | |||
163 | this.renderer.cameraManager().setActiveCamera(cam); | 163 | this.renderer.cameraManager().setActiveCamera(cam); |
164 | 164 | ||
165 | // change clear color | 165 | // change clear color |
166 | this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); | 166 | //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); |
167 | this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); | 167 | this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); |
168 | //this.renderer.NinjaWorld = this; | 168 | //this.renderer.NinjaWorld = this; |
169 | 169 | ||
@@ -206,6 +206,7 @@ function GLWorld( canvas, use3D ) | |||
206 | { | 206 | { |
207 | if (!dt) dt = 0.2; | 207 | if (!dt) dt = 0.2; |
208 | 208 | ||
209 | dt = 0.01; // use our own internal throttle | ||
209 | this.elapsed += dt; | 210 | this.elapsed += dt; |
210 | 211 | ||
211 | if (this._useWebGL) | 212 | if (this._useWebGL) |
@@ -232,39 +233,35 @@ function GLWorld( canvas, use3D ) | |||
232 | { | 233 | { |
233 | g_Engine.setContext( this._canvas.uuid ); | 234 | g_Engine.setContext( this._canvas.uuid ); |
234 | var ctx = g_Engine.getContext(); | 235 | var ctx = g_Engine.getContext(); |
235 | var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle); | ||
236 | if (ctx1 != ctx) | ||
237 | console.log( "***** different contexts (2) *****" ); | ||
238 | var aRenderer = ctx1.renderer; | ||
239 | var renderer = ctx.renderer; | 236 | var renderer = ctx.renderer; |
240 | if (renderer != aRenderer) | ||
241 | { | ||
242 | console.log( "***** DIFFERENT RENDERERS *****" ); | ||
243 | renderer = aRenderer; | ||
244 | } | ||
245 | |||
246 | if (renderer.unloadedTextureCount <= 0) | 237 | if (renderer.unloadedTextureCount <= 0) |
247 | { | 238 | { |
248 | renderer.disableCulling(); | 239 | renderer.disableCulling(); |
249 | //console.log( "GLWorld.draw " + renderer._world._worldCount ); | 240 | //console.log( "GLWorld.draw " + renderer._world._worldCount ); |
241 | renderer._clear(); | ||
250 | this.myScene.render(); | 242 | this.myScene.render(); |
251 | 243 | ||
252 | if (this._firstRender) | 244 | if (this._firstRender) |
253 | { | 245 | { |
254 | this._firstRender = false; | 246 | if (this._canvas.task) |
255 | |||
256 | if (!this.hasAnimatedMaterials()) | ||
257 | { | 247 | { |
258 | //this.myScene.render(); | 248 | this._firstRender = false; |
259 | this._canvas.task.stop(); | 249 | |
260 | //this._renderCount = 10; | 250 | if (!this.hasAnimatedMaterials()) |
251 | { | ||
252 | this._canvas.task.stop(); | ||
253 | //this._renderCount = 10; | ||
254 | } | ||
261 | } | 255 | } |
262 | } | 256 | } |
263 | else if (this._renderCount >= 0) | 257 | else if (this._renderCount >= 0) |
264 | { | 258 | { |
265 | this._renderCount--; | 259 | if (this._canvas.task) |
266 | if (this._renderCount <= 0) | 260 | { |
267 | this._canvas.task.stop(); | 261 | this._renderCount--; |
262 | if (this._renderCount <= 0) | ||
263 | this._canvas.task.stop(); | ||
264 | } | ||
268 | } | 265 | } |
269 | } | 266 | } |
270 | } | 267 | } |
@@ -394,11 +391,9 @@ function GLWorld( canvas, use3D ) | |||
394 | if (this._useWebGL) | 391 | if (this._useWebGL) |
395 | { | 392 | { |
396 | rdgeStarted = true; | 393 | rdgeStarted = true; |
397 | 394 | this._canvas.rdgeid = this._canvas.uuid; | |
398 | this._canvas.rdgeid = this._canvas.uuid; | 395 | g_Engine.registerCanvas(this._canvas, this); |
399 | 396 | RDGEStart( this._canvas ); | |
400 | g_Engine.registerCanvas(this._canvas, this); | ||
401 | RDGEStart( this._canvas ); | ||
402 | 397 | ||
403 | //this._canvas.fpsTracker = new fpsTracker( '0' ); | 398 | //this._canvas.fpsTracker = new fpsTracker( '0' ); |
404 | //this._canvas.task = new RDGETask(this._canvas, false); | 399 | //this._canvas.task = new RDGETask(this._canvas, false); |