I have a problem with my code, I hope somebody can help me:
In my code, I need to read some pixels and redraw them again. For example, a matrix of m*n pixels.
i can do it if I read one by one the pixels:
for(int x=0; x<m; x++)
for(int y=0; y<n; y++ )
glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &Color[y*m+x]);
and then draw them again in the screen (currently I do it with GL_POINTS), and it works (but is slow…)
but if I try to read all the pixels at the same time:
glReadPixels(0, 0, m, n, GL_RGB, GL_UNSIGNED_BYTE, &Color);
when I draw again they aren’t in order. I have tried a lot of things and nothing works correctly, I think maybe the problem is that when you read more than one pixel with glReadPixels, they aren’t stored in order in my array, but i’m not sure.
Thanks so much for the help!