还有问题的可以试下这个代码,我是从 threeJS 源码拿出来的,在几台安卓机器上都可以透明,不加则不透明。webGLCanvasId 设置你们的ID。如果用 threeJS,canvas 和 glContext 要传到 threeJS 里面。 wx.createSelectorQuery() .select(`#${webGLCanvasId}`) .node() .exec((res) => { const canvas = res[0].node; const glContext = canvas.getContext('webgl', { alpha: true, depth: true, stencil: true, antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false, powerPreference: 'default', failIfMajorPerformanceCaveat: false, xrCompatible: true }); // 安卓手机需要调用这个来设置透明 glContext.clearColor(0, 0, 0, 0); glContext.clear(glContext.COLOR_BUFFER_BIT); });
小程序canvas webgl透明背景在开发者工具和真机中显示不一样开发者工具中通过设置 gl.clearColor(1,1,1,0); 使得webgl背景色透明,但是真机上一直显示的是黑色背景
2019-12-27还有问题的可以试下这个代码,我是从 threeJS 源码拿出来的,在几台安卓机器上都可以透明,不加则不透明。webGLCanvasId 设置你们的ID。如果用 threeJS,canvas 和 glContext 要传到 threeJS 里面。 wx.createSelectorQuery() .select(`#${webGLCanvasId}`) .node() .exec((res) => { const canvas = res[0].node; const glContext = canvas.getContext('webgl', { alpha: true, depth: true, stencil: true, antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false, powerPreference: 'default', failIfMajorPerformanceCaveat: false, xrCompatible: true }); // 安卓手机需要调用这个来设置透明 glContext.clearColor(0, 0, 0, 0); glContext.clear(glContext.COLOR_BUFFER_BIT); });
小程序webgl透明背景小程序canvas中webgl能实现透明背景吗?目前测试大部分机型都是黑底,使用 gl.clearColor(0.0, 0.0, 0.0, 0);也无法实现透明
2019-12-27还有问题的可以试下这个代码,我是从 threeJS 源码拿出来的,在几台安卓机器上都可以透明,不加则不透明。webGLCanvasId 设置你们的ID。如果用 threeJS,canvas 和 glContext 要传到 threeJS 里面。 wx.createSelectorQuery() .select(`#${webGLCanvasId}`) .node() .exec((res) => { const canvas = res[0].node; const glContext = canvas.getContext('webgl', { alpha: true, depth: true, stencil: true, antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false, powerPreference: 'default', failIfMajorPerformanceCaveat: false, xrCompatible: true }); // 安卓手机需要调用这个来设置透明 glContext.clear(17664); // 这个数值根据 threeJS 源码得来 });
canvas(webgl)背景透明功能canvas加载模型,如何设置背景透明? 在小米8(android 8.1.0版本)背景是透明的。 在小米8和其它手机(android 9.0版本)背景是黑的。 请问是否和android版本有关,如何兼容其它手机和android版本? [图片]
2019-12-27你们好了么,昨天突然又好了
安卓微信7.0.9 Camera组件调用CameraFrameListener.startAPI黑屏安卓 微信 7.0.9 。Camera 组件 调用 CameraFrameListener.start API 黑屏
2019-12-19已解决[图片]
官方 threejs demo 显示不了模型你好,我在 iPhone 大屏手机上跑官方的 threejs example 工程一片空白,显示不了模型。同样的代码在 iPhone8 上面可以显示。能帮忙看下是什么问题吗?现在我定位到的导致出问题的地方是 canvas 的高度。下面是我测试的机型和测试步骤: 测试机型:iPhone6p/iPhone7p/iPhone X 测试步骤: 1,把 index.xml 第一个 canvas style 里面的 height 改成 456 px 就会显示不了(大于455的值都显示不了),模拟器可以显示。 2,把 index.xml 第一个 canvas style 里面的 height 改成 455 px 就可以显示。 如果你们那边也复现出同样的问题,麻烦告知一声,谢谢g-emoji class="g-emoji" alias="pray" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f64f.png" style=" box-sizing: border-box ; ; ; ; ; ; ; ;; font-size: 1.2em; line-height: 20px; vertical-align: middle; margin-right: 3px; ">🙏/g-emoji>
2019-12-17