Im loading a bitmap from a file as unsigned char array. Then I convert it to floats, do some math with it, and then put it back into another bitmap.
Im using Visual C++ 2010 express, and when Im running the programm in Debugmode it works fine. But as soon as I put it into Releasemode, the output is only a completly black bitmap.
Does anyone have a clue what could cause this? I dont get any warnings at all (with high warninglevel).
That should be everything that is important:
struct f3{
float r,g,b;
};
unsigned char * shadowMapImage;
f3 *shadowMap;
shadowMapImage = new unsigned char[mapWidth*mapWidth*3];
shadowMap = new f3[mapWidth*mapWidth*3];
LoadFromFile(); // Fills shadowMapImage with fread(shadowMapImage, 1, imageSize, filePtr);
k=0;
for(int z = 0; z<mapWidth; z++){
for(int x = 0; x<mapWidth; x++){
shadowMap[z*mapWidth+x].r = shadowMapImage[k];
shadowMap[z*mapWidth+x].g = shadowMapImage[k+1];
shadowMap[z*mapWidth+x].b = shadowMapImage[k+2];
k+=3;
}
}
SomeMathFunctionThatNeedsFloats();
k=0;
for(int z = 0; z<mapWidth; z++){
for(int x = 0; x<mapWidth; x++){
shadowMapImage[(z*mapWidth+x)*3] = (unsigned char)shadowMap[(z*mapWidth+x)].r;
shadowMapImage[(z*mapWidth+x)*3+1] = (unsigned char)shadowMap[(z*mapWidth+x)].g;
shadowMapImage[(z*mapWidth+x)*3+2] = (unsigned char)shadowMap[(z*mapWidth+x)].b;
k+=3;
}
}
SaveToFile();
Thanks
Edited by gnomgrol, 11 July 2012 - 06:38 AM.






