int width = 2560;
int height = 1440;
int frameBuffer[width*height];
for (int i = 0; i < width*height; ++i)
frameBuffer[i]=i;
This code locks
You are probably exceeding the available stack space, causing an overflow. It is not a good idea to have such big arrays on the stack.
Instead of using the non-standard VLA's (variable-length arrays), you can allocate the buffer yourself:
size_t width = 2560;
size_t height = 1440;
int *frameBuffer = new int[width * height];
for (size_t i = 0; i < width * height; ++i)
frameBuffer[i] = i;
...
delete[] frameBuffer;
Also note the usage of size_t
rather than int
. You should stick with size_t
when it comes to allocation sizes, since an int
is not always guaranteed to be capable of holding a size large enough.