michaeltrim Posted November 16, 2016 Share Posted November 16, 2016 Hi, Can anyone recommended a method for integrating Babylon into a an electron app, built with Webpack, using React/Redux? When I import Babylon either as an inline script in head or as an ES6 import, I get the same error which i assume is connected to Electron. I've attached an image of the top of the stack trace and the line in babylon that errors is the this.resize(); as per below; var limitDeviceRatio=options.limitDeviceRatio||window.devicePixelRatio||1.0;this._hardwareScalingLevel=adaptToDeviceRatio?1.0/Math.min(limitDeviceRatio,window.devicePixelRatio||1.0):1.0;this.resize();// Any ideas greatly appreciated. Michael Quote Link to comment Share on other sites More sharing options...
michaeltrim Posted November 16, 2016 Author Share Posted November 16, 2016 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 16, 2016 Share Posted November 16, 2016 can you try to reference babylon.max.js to get a more precise view of the error? Quote Link to comment Share on other sites More sharing options...
michaeltrim Posted November 16, 2016 Author Share Posted November 16, 2016 Hi, Sorry if I wasn't clear, the error is in this.resize() does the attached screenshot give enough detail? thanks, Michael Quote Link to comment Share on other sites More sharing options...
michaeltrim Posted November 16, 2016 Author Share Posted November 16, 2016 This is using the cloud hosted version of 2.4 max, however the error is the same. Quote Link to comment Share on other sites More sharing options...
michaeltrim Posted November 16, 2016 Author Share Posted November 16, 2016 And a view of 'this' when using a breakpoint at line that errors Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 17, 2016 Share Posted November 17, 2016 Something is screwing the code of babylon.js "this" in this context should be the engine. There is something wrong when you reference the framework https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.engine.js#L241 As you can see, the code is correct. Sounds like the context is changed by Electron? Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 17, 2016 Share Posted November 17, 2016 there must be, somewhere, a bind to the BABYLON namespace, as this is the engine's constructor. this should be this. "this should be this"... Now that's a JavaScript-only sentence right here. GameMonetize 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.