Why is the imageData that I get from WebGLRenderingContext.readPixels() upside down?
I try to do the folowing:
var gl = renderer.domElem
You can flip pixels of ImadaData directly like this.
const imageData = new ImageData(Uint8ClampedArray.from(pixels),gl.drawingBufferWidth,gl.drawingBufferHeight);
const w = imageData.width, h = imageData.height;
const data = imageData.data;
Array.from({length: h}, (val, i) => data.slice(i * w * 4, (i + 1) * w * 4))
.forEach((val, i) => data.set(val, (h - i - 1) * w * 4));