Jump to content

webgl error


Recommended Posts

Not sure what invertY is but will checkup on that :)

The scene file I use is exported from blender. I wonder if their is some setting there I could use.


While we are on the topic of webgl error I also get the following error from time to time (usually on firefox)

Error: WebGL: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

Does not seem to have any effect but made me wonder what the issue was.



Link to comment
Share on other sites

I assume you're using power of 2 textures, ( 64, 128, 256, 512, etc.) which are almost always more efficient to render. I believe that I received the same error which was corrected when I realized I was using an odd texture size and resized my image to power of two. But I can't be certain as it was eons ago.

Link to comment
Share on other sites

  • 1 year later...

Apologies for the thread necro, but I'm getting this error during dev as well in FFox: Error: WebGL: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

I understand dispose() works, are there any procedures for GC on canvases/engines I should take note of ? A doc link would be nice here, I think.

Link to comment
Share on other sites

On 8/18/2017 at 0:27 AM, Deltakosh said:

Are you using the latest bjs version (3.1 alpha?) Can you also check using memory snapshots that you do not have a leak that keep the context in memory (like a remaining event)

I'm using 3.0. Memory is showing ~12MB when page loaded dropping to ~5MB after local server d/c (and I believe after GC). Primary calls in script are

    this.viewport.remove(); //canvas removal

I don't think its sufficient. Heap snapshot shows that meshes in the scene are still retained, as well as the scene itself. I have to pore over this in detail. Is there a best practice doc/guide as to removing babylon created object references anywhere ?

edit: I forgot, the GUI elements are also retained in memory, I'm seeing several getNodeText calls. Hope it helps.

Link to comment
Share on other sites

On 8/22/2017 at 1:48 AM, Deltakosh said:

Unfortunately, without a repro, I won't be able to help

I took the PG codes from https://www.babylonjs-playground.com/#FBKE1P#1  and modified to add in a 30s timer (zip file) that disposes the scene and engine. You should be able to obtain the snapshot before timer runs out.

Also, attached my ss fyr. Does this help ?



Link to comment
Share on other sites

Well, I managed to make it reproducible via window.location.reload(true) with the simplest of scenes (as below). A warning tho, this creates an infinite loading of the same page just to speed things up, so have F12 console viewable as the page reloads. I also tested multiple browser refresh in the basic scene of the PG and got the same result. Hope it helps.


		window.addEventListener('DOMContentLoaded', function() {
			function createScene(engine,canvas) {
				var scene = new BABYLON.Scene(engine);
				//Adding an Arc Rotate Camera
				var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
				camera.attachControl(canvas, false);
				return scene;
			var canvas = document.getElementById('renderCanvas');
			var engine = new BABYLON.Engine(canvas, true);
			var scene = createScene(engine,canvas);
			engine.runRenderLoop(function() {
				//canvas = null;
				console.log("scene disposed? " + scene.isDisposed);


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.

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.


  • Recently Browsing   0 members

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