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

The screen is blank whenever I run an example on Mac OS Mojave. #197

Closed
yeswecan opened this issue Oct 19, 2018 · 5 comments · Fixed by #452
Closed

The screen is blank whenever I run an example on Mac OS Mojave. #197

yeswecan opened this issue Oct 19, 2018 · 5 comments · Fixed by #452

Comments

@yeswecan
Copy link

yeswecan commented Oct 19, 2018

Hello there!

I've tried running nannou's examples and so far the screen is just blank in each of them. Not sure what to look for, there's nothing on console or anywhere else. Is there anything I should check to find the cause of this?

Thanks a lot for your effort!

edit: it looks a lot like this issue - rust-windowing/glutin#969
But it seems fixed a while ago. Is it that nannou somehow pulled the old glutin?

@JoshuaBatty
Copy link
Member

Hi @yeswecan thanks for pointing this out to us. We don't have a Mojave OS to test on so thanks for pointing it out. We will take a look at the glutin issue and work to get this working. I'll ping you on here when we think a fix has been made so you can test again for us if that's ok. Cheers.

@yeswecan
Copy link
Author

Hey @JoshuaBatty!

I can look into it myself if you can point me in the right direction if that works for you. I'm not at all familiar with Rust but I could probably try a few things and see if that works and/or test something out on Mojave (if that's even a Mojave thing, I also have a High Sierra hackintosh which I could compare against locally). Let me know if you want me to try smth.

@mitchmindtree
Copy link
Member

@yeswecan I think rust-windowing/glutin#1069 is more likely your issue. It looks like there's a fix for this coming in winit (the cross-platform windowing layer). I think it's a matter of landing that, then landing the fix up the dependency stream (winit > glutin > glium > nannou). If you want to use the fix in the meantime, you might be able to use the cargo [replace] feature to swap out winit for the patched version (either via that git branch or a local version).

@kwoolery
Copy link

kwoolery commented Nov 8, 2018

It seem that Apple has slightly changed the way they OpenGL rendering works on Mojave.

https://stackoverflow.com/questions/52938516/opengl-not-rendering-on-macos-mojave

I've found a small workaround by adding a context update in the swap_buffers function call in src/platform/macos/mod.rs right after the call to flushBuffer. I don't know the exact implication of this change, so use at your own risk for now, but it seems to allow the initial window to render correctly. I haven't tested on anything but Mojave.

#[inline]
pub fn swap_buffers(&self) -> Result<(), ContextError> {
    unsafe {
        match *self {
            Context::WindowedContext(ref c) => {
                let pool = NSAutoreleasePool::new(nil);
                c.context.flushBuffer();
                c.context.update();
                let _: () = msg_send![pool, release];

            }
            Context::HeadlessContext(_) => unreachable!(),
        }
    }
    Ok(())
}

@MacTuitui
Copy link
Contributor

If someone else is facing the same issue, I was not able to use the replace feature of cargo to do the thing it's supposed to do (maybe because the version was not bumped or more probably just because I'm a complete beginner), so I had to add a local override in ~/.cargo/config by specifying the path to winit directly:

paths = ['path/to/git/clone/of/winit']

Now the nannou examples work but I have a ugly warning that this feature is not meant to be used that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants