-
-当前 Bug 的表现(可附上截图)
ctx.fillText的文字,在开发工具上可见,在iOS客户端可见,在安卓客户端不可见
1.
2.
-预期表现
在安卓客户端可见
-复现路径
-提供一个最简复现 Demo
import * as THREE from './libs/three.min.js'
let ctx = canvas.getContext('webgl')
let cameraOrtho, sceneOrtho
let width,height
let stepText
let texture3
let stepCanvas = wx.createCanvas('canvas')
let stepContext = stepCanvas.getContext('2d')
let stepNum=0
init();
animate();
function init(){
width = window.innerWidth;
height = window.innerHeight;
sceneOrtho = new THREE.Scene();
cameraOrtho = new THREE.OrthographicCamera(- width/ 2, width / 2, height / 2, - height/ 2, 1, 10);
cameraOrtho.position.z = 10;
StepText() ;
renderer = new THREE.WebGLRenderer({ antialias: true, context: ctx });
renderer.setClearColor(0x454545);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.autoClear = false;
document.body.appendChild(renderer.domElement);
}
function StepText() {
stepCanvas.width =128;
stepCanvas.height = 64;
stepContext.font = "20px Arial";
stepContext.fillStyle = '#00ff00';
stepContext.clearRect(0, 0, stepCanvas.width, stepCanvas.height);
stepContext.fillText("步数:" + stepNum, 0, 48, stepCanvas.width, stepCanvas.height);
texture3 = new THREE.CanvasTexture(stepCanvas);
let material3 = new THREE.SpriteMaterial({ transparent: true, opacity: 1 });
material3.map = texture3;
let width3 = stepCanvas.width;
let height3 = stepCanvas.height ;
stepText = new THREE.Sprite( material3 );
stepText.scale.set( width3, height3, 1);
stepText.visible = false;
stepText.position.set( -width / 2 + 80, height / 2 - 72, 1);
sceneOrtho.add(stepText );
}
function animate() {
requestAnimationFrame(animate);
texture3.needsUpdate = true;
render();
}
function render(){
renderer.clear();
renderer.render(sceneOrtho, cameraOrtho);
}
这个Bug现在还有 真机不显示
解决没?
问题解决了吗
开发者工具可显示“步数:0”
2.安卓客户端不显示