I am using the MiniLibX for a Raytracer school project. I want to take snapshots of my Raytracer and store them into ".bmp" bitmap files.
I am following a very useful guide i found on the net : http://ricardolovelace.com/creating-bitmap-images-with-c-on-windows.html
Everything seems to work fine except for the offset setting.
If I put it to 0 in the header, the first 18 pixels of the image are random, and I get a stripe from the right side on the left (18 pxl wide). If i put an offset at 54 bytes (the correct amount of byte that should be offset), the file is corrupt (no software will open it).
here's an example (see the shadow one the left): raytracer example with unwanted strip on the left
So I found another resource to help me print the actual header that was recorded in the file and check for errors (see at https://gist.github.com/j-marjanovic/5319384ad6606d6fd6d6). I find that if I set the offset to 1, the bitmap records an offset of 65536, when i set it to 54 it gives me 65536 * 54.
I am lost on what could change drastically the offset I write to such a huge value, and curious to know how bitmaps are read by the different softwares. I have read many topics on stack overflow and throughout the web, but could not find this exact problem. This posts resembles it, but the source of the problem seems different to me (i can't relate with my issue): Directshow & .Net - Bitmap shows stripe from right on left side of image?
My only guess is it could be related to the color table, but I'm not sure I understand when this is neccesary.
Anyway, if you want a look at my code i'll upload it, and thank you for any leads you may have on that issue !