MinsuKim Posted July 25, 2018 Share Posted July 25, 2018 hi as always one problem T.T issue is how to multiple *.babylon file load? i have 16 files one file has 31box create by 3DMAX my code is below for (let i = 0; i < resourceCount; i++) { onLoadImage(); } function onLoadImageFileT() { BABYLON.SceneLoader.AppendAsync(strResourceURL, fileName, scene, function (newScene) { newScene.executeWhenReady(function () { let loadMesh = newScene.getMeshByName("resoucreName"); scene.lights[1].dispose(); loadMesh.position = new BABYLON.Vector3(machineForLayout.mPositionX, machineForLayout.mPositionY, machineForLayout.mPositionZ); loadMesh.scaling = new BABYLON.Vector3(0.035, 0.035, 0.035); loadMesh.rotation.y = machineForLayout.mRotationY; loadMesh.name = "Machine#" + machineForLayout.mMachineId; loadMesh.id = "Machine#" + machineForLayout.mMachineId; loadMesh.isPickable = true; }); }, function (progress) { // To do: give progress feedback to user }, function (error) { console.log(error); }); } problem is 12file load is OK but 15 file over is "Too many active WebGL contexts. Oldest context will be lost." i do not understand message.. i many search and try other code... but same issue (assetmanager, importMesh, Append) please help me Quote Link to comment Share on other sites More sharing options...
Guest Posted July 25, 2018 Share Posted July 25, 2018 It seems that you are creating a new Engine per file. Can you share the entire code? Or reproduce the problem in the Playground? MinsuKim 1 Quote Link to comment Share on other sites More sharing options...
MinsuKim Posted July 26, 2018 Author Share Posted July 26, 2018 @Deltakosh hi my Star! new engine per file not correct. var engine = new BABYON.Engine(); i think it is one time call because private member variable i'm not try playground and shared.. T.T (*.babylon file is our company equipment modeling ) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 26, 2018 Share Posted July 26, 2018 have you tried with BABYLON.SceneLoader.Append instead of BABYLON.SceneLoader.AppendAsync just to test that. MinsuKim 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 26, 2018 Share Posted July 26, 2018 For some attempts in this topic I made a project that loads more than 16 fileshttps://happy-hamilton-38ec27.netlify.com/workercoreblocks22 code here https://github.com/BabylonJSGuide/largemaps/blob/master/workerCoreBlocks22.html It might give you some help (or not) ? MinsuKim 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted July 26, 2018 Share Posted July 26, 2018 We need a repro to help you MinsuKim 1 Quote Link to comment Share on other sites More sharing options...
MinsuKim Posted July 27, 2018 Author Share Posted July 27, 2018 @Dad72 i tried BABYLON.SceneLoader.Append instead of BABYLON.SceneLoader.AppendAsync but same thing thank you for reply! @JohnK you code is good I have updated my code by comparison. thank you for reply! @Deltakosh you correct! my code some changed! this problem is solved but I do not know how it was resolved. BABYLON.Engine.isSupported() Issue...???? don't know ㅇ_ㅇ.... Thank you to everyone who helped me. see you later with other Issue! lol my code below before for (let i = 0; i < machineCount; i++) { if (BABYLON.Engine.isSupported()) { onLoadImage(); } } after for (let i = 0; i < machineCount; i++) { onLoadImage(); } Quote Link to comment Share on other sites More sharing options...
Guest Posted July 27, 2018 Share Posted July 27, 2018 perfect! ANd you are right IsSupported will create a temp canvas so it is a good idea to call it only once MinsuKim 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.