Forum

User posts JohnDun
01 March 2018 17:24
Also, what do you define already running as?
28 February 2018 19:24
Ah right I see, that's really interesting.

I got it to work using the React lifecycle hooks in one component, but there is an unusual bug which causes the app to restart the first couple times I run the WebGL component.

Having read your second comment though I'm almost sure that's what happens with mine.

Will have to give this a try - here is a look at how I got it to work.

https://github.com/JohnDun89/MyDeveloperReactSite/blob/master/client/src/containers/webGl.js
19 February 2018 18:36
Thanks for the reply.

I have been following this tutorial and got a scene working https://www.blend4web.com/en/community/article/408/.

After that, I built an app using React and a node js backend. The code I am using is pretty similar, but when it comes to calling load ( this.load in react) I always get a cannot read property undefined.

I'm thinking it could be something to do with passing a bad path across.


init_cb(canvas_elem, success) {

if (!success) {
console.log("b4w init failure");
return;
}
m_preloader.create_preloader();

// ignore right-click on the canvas element
canvas_elem.oncontextmenu = function (e) {
e.preventDefault();
e.stopPropagation();
return false;

};
//here is the error
this.load();

}

load() {
m_data.load(APP_ASSETS_PATH + "dinburgh.json", this.load_cb, this.preloader_cb);
}

preloader_cb(percentage) {
m_preloader.update_preloader(percentage);
}
load_cb(data_id, success) {


The link you provided gives me an access denied 403
18 February 2018 15:53
Hello,

Does anyone have an example of using React with blender4web?

I have exported my scene to JSON and added it to my project, but can't get it to load in the Iframe.

Any advice would be great.