Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows, buffers larger than the window cause weird artifacts and look horrible #221

Closed
LoganDark opened this issue Oct 8, 2020 · 20 comments

Comments

@LoganDark
Copy link
Contributor

At least on Windows, displaying a buffer larger than the size of the window causes weird artifacts.

My ray tracer is a good example of this, and is how the bug was discovered.

At 1x resolution:

image

At 2x resolution:

image

My friends with real Windows machines originally reported this bug to me, then I confirmed that it also happens in Wine, so I think the problem is minifb.

@LoganDark
Copy link
Contributor Author

Here are some gifs

Bug:

raytracerbugwindows

Not bug:

raytracernotbugwindows

The only difference is the resolution of the framebuffer - no color calculation is affected by resolution in my code, in fact nothing is except for the amount of rays that are put out.

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

Exactly how do you send this larger than window buffer to minifb?

@LoganDark
Copy link
Contributor Author

LoganDark commented Oct 8, 2020

@emoon by using update_with_buffer ... ??? By "larger than the window" I mean in terms of resolution.

It's exactly the same as sending a buffer that's the same size as the window, or smaller than the window.

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

ok, I will have to investigate it. You can workaround the issue by scaling it manual (which you may or may not want to do anyway if you want super-sampled downscaling) minifb on will only scale with nearest filtering.

@LoganDark
Copy link
Contributor Author

LoganDark commented Oct 8, 2020

And you can also make it better by adding a function for me to query DPI scaling (since I only multiply the resolution by 2 to support high DPI on macOS, but then it causes bug on windows -_-)

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

temporary you can always check if you are running on macOS or Windows.

@LoganDark
Copy link
Contributor Author

🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮 🤮

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

Hey, I wrote temporary above.

@LoganDark
Copy link
Contributor Author

I'd rather wait for a fix is what I mean lol

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

Also, if you are in such hurry you can add it yourself.

@LoganDark
Copy link
Contributor Author

LoganDark commented Oct 8, 2020

Sorry, I did not mean to imply that I was in any sort of hurry, but you're not being very helpful by telling me to go do it myself.

Like I said, I'm more than happy to wait for a fix, apologies if anything I said came off the wrong way

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

I said if you want super-sampled down scaling (i.e anti-aliasing) you would have to do yourself (as minifb doesn't support it) regular scaling should work, but I don't think I have tested with buffer larger than the window.

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

I can try to get dpi_scale function added during the weekend.

@LoganDark
Copy link
Contributor Author

LoganDark commented Oct 8, 2020

Oh, you're misunderstanding me then. I'm taking advantage of the extra pixels on macOS, not trying to do antialiasing (I already have that). However somehow that causes minifb on Windows to flip out when the display doesn't have those extra pixels.

Apparently an entire Discord chat just agreed that the vomiting faces were exactly equivalent to "FUCK YOU WTF I NEED THIS FIXED RIGHT THIS MINUTE", so I'm sorry if it came off that way (that's really, really not what I meant). I was replying to the "check if the OS is macOS" hack specifically

@emoon
Copy link
Owner

emoon commented Oct 8, 2020

Fair enough, yeah that is how I pretty much interpret it as well. Understood. I will get the scaling value return added soonish.

@emoon
Copy link
Owner

emoon commented Oct 10, 2020

won't get around to implement it this weekend

@LoganDark
Copy link
Contributor Author

Any progress on that dpi_scale function?

@emoon
Copy link
Owner

emoon commented Oct 21, 2020

Sorry, not yet

@emoon
Copy link
Owner

emoon commented Feb 15, 2021

Just FYI I have started to work on this but it's quite a lot of work.

@emoon emoon mentioned this issue Feb 19, 2021
4 tasks
@emoon
Copy link
Owner

emoon commented Feb 19, 2021

Being tracked in #236

@emoon emoon closed this as completed Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants