I'm wondering that, when using glGetTexImage, what format is the texture in? For example, say the texture is 1920 x 1080 and the pixel format is R8G8B8A8. Now, I figure I can't simple have a loop like this:
for (int x = 0; x < TextureWidth; x++) { for (int y = 0; y < TextureHeight; y++) { bla.SetPixel(x, y, Color.FromArgb(glImage[x, y, 0], glImage[x, y, 1], glImage[x, y, 2])); } }
I figure this because if I try that, then the image is...strange:
{"name":"599389","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/eef27875ec139019b9b9af4aee1199f8.png","w":480,"h":270,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/e\/eef27875ec139019b9b9af4aee1199f8"}
When it should be more like this:
{"name":"599390","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/b\/cb8379e5a153e21575901f031d752776.png","w":283,"h":162,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/b\/cb8379e5a153e21575901f031d752776"}
Basically, how do I use the data from glGetTexImage into the standard (0, 0) is top left and (W, H) is bottom right?
Not sure exactly what language you're using there for "glImage[x, y, 0]" to reference anything other than the very first byte, but with R8G8B8A8 (assuming you mean that you're specifying a format of GL_RGBA and a type of GL_UNSIGNED_BYTE) each pixel will be a byte of red, then a byte of green, then a byte of blue, then a byte of alpha.
So, example code:
Peculiar. I was using C#.
With a few changes based on your code it works now.
Thanks!