5

I'm trying to render the cube using this example: Add a 3D model.

Example work up to 117 version on three.js. Since 118 version example doesn't work: cube disappears immediately after page refresh. I studied changelog and most noticeable change is that since v118 three.js uses WebGL2 as default render engine. So I changed code to use WebGL1, but still cube disappears.

  this.renderer = new THREE.WebGL1Renderer({
  canvas: map.getCanvas(),
  context: gl,
  antialias: true
});

Here is codepen to reproduce the problem. (reload page to see the cube for a moment)

3
  • 2
    I had the same issue, it’s even better, if you want to LOL, add 2 cubes and it works. Honestly I think it’s a bug. If you are going to play hard with Mapbox and Three.js I’d recommend you to check threebox out Commented Aug 12, 2020 at 19:01
  • Thank you, @jscastro! adding second cube solved the problem O_o. I'll definitely checkout threebox. What can you tell about maptalks? Commented Aug 12, 2020 at 19:07
  • It’s an amazing framework but I decided to go with mapbox because it’s also the core of Azure Maps and I found several serious issues with models in maptalks Commented Aug 12, 2020 at 19:29

1 Answer 1

2

I had the same issue, but it was resolved by replacing renderer.state.reset() in the render() function with renderer.resetState() which was introduced in r124 and improved in r126.

Mapbox example has also been updated.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.