I'm trying to use the generic overloads on GL.ReadPixels to read information from a texture attached to a frame buffer object
If I use this
GL.ReadPixels(0, 0, PIXSIZE, PIXSIZE, PixelFormat.Rgba, PixelType.UnsignedByte, ImgArray);
I get a 1D array of values but what I want to get is an array of struct containing separate RGBA channels for each pixel in the texture. I assume I can use ReadPixels<> for this.
I defined a struct
public struct RGBA
public byte R;
public byte G;
public byte B;
public byte A;
Then declared an array of this type
RGBA[,] pixelsxy = new RGBAByte[PIXSIZE, PIXSIZE];
And called the corresponding overload
GL.ReadPixels(0, 0, PIXSIZE, PIXSIZE, PixelFormat.Rgba, PixelType.UnsignedByte, pixelsxy);
All I get back is an empty array
What am I doing wrong - I could really do with an example of how this is supposed to work.
Thanks a lot for you help.