I defined an array pointer to hold a massive amount of data, (actually the RGB data of a screen with 1024*768 pixels). the data is assigned from another temporary array to the this array within a function that calculates the values of the temporary array and then assign them to the global one using FOR loops. the global array values should be kept saved to be used in an OpenGL function as a store of an image data and then display the image on the screen.
when I run the program, the program works fine until it reaches a specific row number of the screen rows (row number 16 of 128 rows) and crash giving the following message:
Unhandled exception at 0x7c812afb in OPENGL_.....exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012fbb4..
any one can help me in this please?
how can I get rid of this error and make the program works?
I get the same message when I add a delete function (delete  pixels_index to delete the array of pointers, for that reason I think the problem is about the array (pixels_index)
many thanks in advance
here is parts of the OpenGL code in C++ environment: