Jump to content

calling scene.render outside of runRenderLoop


fenomas
 Share

Recommended Posts

Is there an way to (safely) manually control the timing of render calls, instead of leaving them to engine.runRenderLoop?

If I just call scene.render() directly, random bugs occur - for example, camera movement controls stop working. Apparently this is because engine.getDeltaTime() returns 0, so I'd imagine that physics and animations would break too.

 

Is there a safe way to do this, or is runRenderLoop mandatory?

Link to comment
Share on other sites

Hey :)

For what use do you want to render a scene outside of runRenderLoop ?

 

Delta time is computed in engine.beginFrame() -> _measureFps(), it means that if you need to be synchronized with animations etc you must render your scene (if animations) between beginFrame() and endFrame() in the engine using renderLoops.

 

You can try to set the deltaTime using engine.deltaTime = my_value ?

Link to comment
Share on other sites

Thanks! :D

 

Ok, if there's no "official" way then I'll try manually calling beginFrame and endFrame, and see if anything breaks. Seems to work so far, anyway.

 

As for why I'm doing it, essentially I'm trying to use BJS as a dependency, in code I was already working on that managed its own render loop. So I'm trying to avoid having the higher-level loop getting called by the lower one.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...