If I make an array like this
GLubyte bufImage[100][100][3];
I can pass bufImage to a function and then get the values using:
r = bufImage[im_x][im_y][0];
g = bufImage[im_x][im_y][1];
b = bufImage[im_x][im_y][2];
However, if I don't know Width and Height at runtime, this does not work. I tried to do this:
GLubyte*** bufImage = new GLubyte**[Width];
for(unsigned int i = 0; i < Width; ++i)
{
bufImage[i] = new GLubyte*[Height];
for(unsigned int j = 0; j < Height; ++j)
{
bufImage[i][j] = new GLubyte[3];
}
}
but it crashes when I try to access them. Can someone help me make this 2d array at runtime?
Thanks,
Dave