You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although the tutorial 5 doesn't mention about the need of checking the bmp file's bpp when loading, but in common/texture.cpp it does do. However, according to the wiki, it shows that the size of data representing the bpp of bitmap is actually 2 bytes:
Offset (hex)
Offset (dec)
Size (bytes)
Windows BITMAPINFOHEADER[1]
1C
28
2
the number of bits per pixel, which is the color depth of the image. Typical values are 1, 4, 8, 16, 24 and 32.
I'm curious why this statement can work,
// the original one...if ( *(int*)&(header[0x1C])!=24 ) ...
// ...or the re-write version by me unsignedint bpp = *reinterpret_cast<int*>(&header[0x1C]);
if (bpp != 24) ...
but I think casting it into short* should make more sense, since short is 2-byte-size in this case. And changing this doesn't affect the correctness.
Although the tutorial 5 doesn't mention about the need of checking the bmp file's bpp when loading, but in
common/texture.cpp
it does do. However, according to the wiki, it shows that the size of data representing the bpp of bitmap is actually 2 bytes:I'm curious why this statement can work,
but I think casting it into
short*
should make more sense, sinceshort
is 2-byte-size in this case. And changing this doesn't affect the correctness.The text was updated successfully, but these errors were encountered: