Jump to content

handling of WebGL contexts


hybridius
 Share

Recommended Posts

hey everyone,

 

I've been around this forum a couple of times, and have usually found what I am looking for somewhere, but I'm a bit at a loss right now.

 

I'm using Babylon.js to visualize architectural plans. The pre-babylon.js calculations have become sufficiently fast to load a number of scenes in quick succesion after another. My problem: This does not delete the webgl / babylon context. Anytime I load a new scene, the old one does not disappear (obvious from performance).

 

I have come up with a number of ideas, but none have helped thus far.

1) I have deleted and recreated the object responsible for anything babylon.js.

This has had no effect.

 

2) There is only one active canvas at all times. Whenever a new scene is created, I delete the canvas, and do a parentNode.replaceChild with a new one.

This has had no effect.

 

3) I have reset the old WebGL context to it's initial state (see https://www.khronos.org/webgl/wiki/Debugging), and created a new one.

This has returned me a slew of errors

 

WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program         babylon.2.0.js:4

WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program         babylon.2.0.js:4
WebGL: INVALID_OPERATION: uniform4f: location not for current program                          babylon.2.0.js:4
WebGL: INVALID_OPERATION: drawElements: no valid shader program in use                    babylon.2.0.js:4

 

from babylon.js and breaks performance, showing me again that babylon.js tries to perform actions on the old context.

 

As far as I am aware, I can not actively delete WebGL contexts - I have to wait for garbage collection to do that for me - but maybe I can disable any functions on that context or something the like? I would really appreciate help on the topic.

 

As a side note, I'd appreciate tips on performance in general.

 

hybridius

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...