您好我正在使用以下webgl脚本从渲染对象中读取,这适用于Chrome但在Firefox和IE中提供“错误:WebGL:readPixels:无效类型浮点数”
代码段:
var gl = this.renderer.getContext();
var pixels = new Uint8Array(this.net.RESOLUTION * this.net.RESOLUTION * 4);
gl.readPixels(0, 0, this.net.RESOLUTION, this.net.RESOLUTION, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
提前致谢 亚洲时报Siddharth
答案 0 :(得分:0)
问题出在
var renderTarget = new THREE.WebGLRenderTarget(width, height, {
wrapS : THREE.RepeatWrapping,
wrapT : THREE.RepeatWrapping,
minFilter : THREE.NearestFilter,
magFilter : THREE.NearestFilter,
format : type,
type : THREE.FloatType,
stencilBuffer : false
});
这里输入:Chrome中允许使用THREE.FloatType但Firefox中不允许! 所以工作WebGlRenderTarget是
var renderTarget = new THREE.WebGLRenderTarget(width, height, {
wrapS : THREE.RepeatWrapping,
wrapT : THREE.RepeatWrapping,
minFilter : THREE.NearestFilter,
magFilter : THREE.NearestFilter,
format : type,
stencilBuffer : false
});