[英]Three.js - can't render cube on Mapbox GL JS custom WebGL layer
我正在尝试使用此示例渲染多维数据集:添加 3D model 。
three.js 上的示例工作高达 117 个版本。 由于 118 版本示例不起作用:页面刷新后立方体立即消失。 我研究了变更日志,最明显的变化是从 v118 开始 three.js 使用 WebGL2 作为默认渲染引擎。 所以我更改了代码以使用 WebGL1,但立方体仍然消失了。
this.renderer = new THREE.WebGL1Renderer({
canvas: map.getCanvas(),
context: gl,
antialias: true
});
这是重现问题的codepen 。 (重新加载页面以查看立方体片刻)
我遇到了同样的问题,但是通过将render()
function 中的renderer.state.reset()
renderer.resetState()
替换为在 r124 中引入并在 r126 中改进的 renderer.resetState() 解决了这个问题。
Mapbox 示例也已更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.