cocos-engine
cocos-engine copied to clipboard
RenderTexture.readPixel 方法在web和native表现不一致
Cocos Creator version
3.8.2
System information
mac sonoma, chrome, ios 12, android
Issue description
该方法的签名为 public readPixels (x?: number, y?: number, width?: number, height?: number, buffer?: Uint8Array): Uint8Array | null https://github.com/cocos/cocos-engine/blob/d7aae745748dd132281b93c86d0bb0d778c8a9ad/cocos/asset/assets/render-texture.ts#L227
如果这样写:
const buffer = new Uint8Array(4)
texture.readPixels(0,0,1,1, buffer)
那么在浏览器环境下,buffer可以获取到像素值,但是在原生(ios、android)环境下,buffer的值不变。
Relevant error log output
No response
Steps to reproduce
如问题描述。
Minimal reproduction project
No response