skyfish-qc / pixi-miniprogram

一个可运行于微信小程序的PIXI引擎,通过模拟window环境,有些功能小程序无法模拟,就直接修改了PIXI引擎代码,最终使得PIXI引擎正常运行在小程序上
MIT License
138 stars 35 forks source link

安卓机AR识别叠加PIXI执行动画黑屏 #12

Closed EthanZhong closed 3 years ago

EthanZhong commented 3 years ago

这个是官方的问题,不知道可否帮忙解决。测试THREE是解决了这个问题。看了点THREE 的源码,模范测试好像还是不行。

export function wrapperContext(canvas) { if (typeof canvas.getContext2 != 'function') { canvas.getContextOrigin = canvas.getContext; canvas.getContext2 = function(type = 'webgl', options = null) { type = 'webgl'; options = options || { alpha: true, depth: true, stencil: true, antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false, powerPreference: 'default', failIfMajorPerformanceCaveat: false, xrCompatible: true }; var gl = canvas.getContextOrigin(type, options); //gl.clearColor(0, 0, 0, 0); //gl.clear(gl.COLOR_BUFFER_BIT); return gl; } canvas.getContext = function(type, options) { var gl = canvas.getContext2(type, options); gl.fillRect = function() {} gl.fillStyle = ''; gl.drawImage = function() {} gl.getImageData = function() {} return gl; } } }