PDA

View Full Version : Reading out Colorvalues (OpenIL)



TheBlob
01-28-2002, 07:49 AM
Hi!
I want to read out the colorvlaues of the pixels on a bitmap loaded with OpenIL/DevIL -Lib...But it really doesnīt work. Hereīs my code:



ilGenImages(1, &BitmapID);
ilBindImage(BitmapID);

ilLoadImage("bitmap.bmp");
ilGetInteger(IL_IMAGE_WIDTH);
ilGetInteger(IL_IMAGE_HEIGHT);

ILubyte *cData = ilGetData();

int bytes_pp = ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);

int i_max=ilGetInteger(IL_IMAGE_WIDTH)*ilGetInteger(IL _IMAGE_WIDTH)*bytes_pp;


for(int i=0;i<i_max-bytes_pp;i++)
{
int t_i=i/bytes_pp;

color_map[t_i].r = cData[i+0];
color_map[t_i].g = cData[i+1];
color_map[t_i].b = cData[i+2];

}


Ok, no compiler-errors, no runtime errors, but the colorvalues arenīt correctly saved to my variables...
Whatīs wrong with it???

[This message has been edited by TheBlob (edited 01-28-2002).]

[This message has been edited by TheBlob (edited 01-28-2002).]