vblanco20-1 / vulkan-guide

Introductory guide to vulkan.
https://vkguide.dev/
MIT License
940 stars 213 forks source link

Calculation of the flash value using abs, instead of std::abs or fabs. #97

Closed Julian-Mej closed 6 months ago

Julian-Mej commented 8 months ago

float flash = abs(sin(_frameNumber / 120.f)); This line is causing a problem when running the code from the "Mainloop Code" chapter. The abs function outside the std-namespace casts the parameter to an int, which leads to flash always being zero, making the screen always appear black. I suggest replacing it with std::abs or `fabs. This StackOverflow answer explains why that makes a difference: https://stackoverflow.com/a/3118188.

vblanco20-1 commented 6 months ago

Fixing it on next update