emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
1.01k stars 97 forks source link

Is there any way to flip the Y coordinate? #248

Closed smukherjee2016 closed 3 years ago

smukherjee2016 commented 3 years ago

Hi there, thanks so much for the wonderful crate!

I am currently using this crate with my ray tracer I'm implementing in Rust, but due to difference in coordinate systems between my ray tracer and OpenGL (possibly), the image comes up as flipped:

image

Is it possible to have an option to fix this by some configuration option? Thanks again!

emoon commented 3 years ago

Hey and thanks!

While it would be possible to implement such feature I'm not sure if it's worth the added complexity in this case. As the data comes from OpenGL it's possible to flip one of the sign for -y in your projection matrix (I think, not fully sure of your setup) to allow it to be displayed the other way around.

Otherwise a different loop to copy the data row by row backwards would do the trick as well.