glReadPixels reboots my comp :)

Started by
10 comments, last by BrennendeKomet 19 years, 9 months ago
Quote:Original post by lonesock
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

hmm no :)
This setting is useful only for reading unsigned bytes. But since GLfloat is 4-byte aligned, there is no need to call glPixelStore because OpenGL's default is 4 already.
Advertisement
Huh... i found what was the problem, so if anyone is interested - here we go:
At first, my question did not reflect my problem:
I posted:
float colors[3*600*600];

while in my program it was:
float colors[3*600];

so this is where i got "happens when the allocated memory for the array doesn't fit with the resolution" (c) JazzD
Now when i corrected this stupid mistake, i received a "stack overflow" error in the debugger (note: this time it was at run-time, but not during the compilation).
Finally, making use of the dynamic allocation (just once - at the start of the program), i received the correct result :)

Thanks everybody for help!
C++ RULEZ!!! :)

This topic is closed to new replies.

Advertisement