Quick question: in Graphics.RequestIntoNativeArray, what is the definition of the indices of the resulting array?
I assumed it would be row-major, i.e. element [1] would be the pixel in the top row (x = 0) and the second column from the left (y = 1). A quick test seems to show this is not true.
Is there a specification for this? The docs page doesn’t give more information.
I am reading a RenderTexture from a camera into my script if the source is relevant.
It seems that index [0] is the bottom-left corner (from the perspective of the camera) and index [1] is the pixel to the right of it. I.e., index [width-1] would be the bottom-right corner and index[width] would be the left-most column and the second row from the bottom.
Picture to illustrate. Here I render a camera to a 4x4 texture and print all the non-empty indices.
It would be great if somebody could confirm or deny this.
Unity uses OpenGL convention where the origin is at the bottom left.