-
Notifications
You must be signed in to change notification settings - Fork 221
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
Can't write new pixels to winit window via graphics context after pixels are already written #497
Comments
I haven't looked in detail at the problem you're having but it reminded me of rust-windowing/winit#1605 which I ran into in the past. |
I don't think winit is calling |
It turned out that I had missed something obvious in my testing of |
I am the author of the library Softbuffer, a library that integrates with winit to show a 2D buffer in a window without GPU acceleration (and thus it's more widely compatible than GPU-based systems). It uses core-foundation-rs for its Mac OS support, which was PR'd by someone else as at the time of writing I did not have access to a Mac OS computer.
Since then I have gained access to an old one (won't run anything newer than High Sierra, in case that matters) and I have found a bug in their implementation and I've been trying to fix it over the past few days to no avail. The issue is that when a buffer is shown on the window (via
draw_image
) then another can't be shown again until the window resizes. That is, if there is an attempt show another, the old image remains in its place.I've been pouring over the relevant documentation from Apple, and I can't find anything wrong with the PR'd code based on that. I also tried guessing various things (like recreating the graphics context each time a new buffer is drawn), but each failed in some way (recreating the graphics context returns null instead of a new context, for example).
As such, I'd like to ask for help with fixing this. I don't think that it's likely that it's a bug in core-foundation-rs, but this seems like the best place to ask this where there will be a concentration of people who will know how to help. If you have any examples of using core-foundation-rs with winit, that would also be very useful since then I can compare to the code in my library.
Here is the code that implements Mac OS support via core graphics: https://github.com/john01dav/softbuffer/blob/master/src/cg.rs
Here is a demo that tries to show an animation, and can reliably reproduce the bug (to run, clone this repo then
cargo run --example animation
): https://github.com/john01dav/softbuffer/blob/master/examples/animation.rsI would greatly appreciate any help that you are able to provide.
The text was updated successfully, but these errors were encountered: