Dustin Silk
Dustin Silk

Reputation: 4610

Three.js error with multiple canvases and JSON loaded geometry

I'm attempting to create multiple views and have copied the example code found here exactly and it works perfectly.

However as soon as I replace the geometries with one that i've built in blender it throws an error:

Cannot read property 'length' of undefined - three.js 21532

In the animate / render loop it renders the first canvases first frame, then the second canvases first frame it throws the error.

I know it has something to do with object.__webglInit being undefined for the second object.

Upvotes: 0

Views: 46

Answers (1)

WestLangley
WestLangley

Reputation: 104783

Currently, you can't share geometries across different renderers.

In your case, you will have to clone your geometry using a pattern like so:

var mesh = new THREE.Mesh( geometry.clone(), material );

three.js r.71

Upvotes: 1

Related Questions