-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
Hi!
First of all thank you for great tutorials on 3D graphics.
There is an issue when building project on Windows with GCC. In initial commit in file tinyraycaster.cpp in function drop_ppm_image you have:
std::ofstream ofs(filename);
ofs << "P6\n" << w << " " << h << "\n255\n";
On Windows GCC replaces \n in output file with platform specific code 0x0D0A, what is incorrect (it should be 0x0A in the file). This result in incorrect *.ppm image representation.
This happens because of opening file in "text" mode. To fix this, file should be opened in "binary" mode, for example like this:
std::ofstream ofs;
ofs.open(filename, std::ofstream::out | std::ofstream::binary);
ofs << "P6\n" << w << " " << h << "\n255\n";
Then everything works correctly. I think this patch would not affect other platforms.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels