1 回答

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超6個(gè)贊
在代碼段中發(fā)布最小存儲(chǔ)庫(如果需要調(diào)試幫助)
這在蘋果和iPhone上的野生動(dòng)物園中適用于我
function test(antialias) {
const gl = document.createElement('canvas').getContext('webgl', {
preserveDrawingBuffer: true,
antialias,
});
gl.clearColor(1, 0.5, 0.25, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
const pixel = new Uint8Array(4);
gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel);
log(JSON.stringify(gl.getContextAttributes(), null, 2));
log('pixel:', pixel);
}
function log(...args) {
const elem = document.createElement('pre');
elem.textContent = args.join(' ');
document.body.appendChild(elem);
}
test(false);
test(true);
添加回答
舉報(bào)