Translating 3-dimensional array reference onto 1-dimensional array
- by user146780
If there is an array of ar[5000] then how could I find where element [5][5][4] would be if this was a 3 dimensional array? Thanks
I'm mapping pixels:
imagine a bimap of [768 * 1024 * 4]
where would pixel [5][5][4] be?
I want to make this:
static GLubyte checkImage[checkImageHeight][checkImageWidth][4];
static GLuint texName;
bool itt;
void makeCheckImage(void)
{
Bitmap *b = new Bitmap(L"c:/boo.png");
int i, j, c;
Color cul;
for (i = 0; i < checkImageHeight; i++) {
for (j = 0; j < checkImageWidth; j++) {
b->GetPixel(j,i,&cul);
checkImage[i][j][0] = (GLubyte) cul.GetR();
checkImage[i][j][1] = (GLubyte) cul.GetG();
checkImage[i][j][2] = (GLubyte) cul.GetB();
checkImage[i][j][3] = (GLubyte) cul.GetA();
}
}
delete(b);
}
work without making a multidimensional array.
width = 512, height = 1024....