the width of my image in pixels is 490, the height is 450.
When width and height are equal, it reads fine, but when height is 450, there is an error, something like :“Access violation writing location 0xXXXXXXXX”
Since you specify GL_INT as the type for pixel data, GL will use 3 * sizeof(int) for every pixel in your readback buffer. If your int size is 32 bits, your readback buffer will be too small and the readback will result in an access violation.
Try using ‘new int[widthheight3]’ or ‘new unsigned char[widthheight4*3]’ instead.
[This message has been edited by roffe (edited 02-03-2004).]
On a sidenote, GL’s default pixel pack/unpack state may lead to unexpected results for image widths that are not whole multiples of four.
If you want to avoid these problems, add this to your init code