-
Notifications
You must be signed in to change notification settings - Fork 15
Add a chapter on adding nannou to existing projects #26
Comments
nannou pretty much requires running on the main thread if you want to use its windowing and application events, as macos requires calling a whole lot of their windowing/application event api on the main thread (a giant PITA). That said, it should now be possible to integrate anything laser/audio/osc related quite easily as they each have their own standalone crates. All the graphics stuff we currently expose is quite integrated with the nannou loop though I guess. Come to think of it, you could import the nannou crate just to use the |
Would this apply to Linux? |
I don't think so, I think macOS is the main culprit. I think if you search for "main thread macos" in the winit issues you might find lots of old discussion on the topic. |
I guess in my mind and the way I was interpreting the question from a few people was: MacOs really ruins this vision haha. I think we should still make a section on how to do this but maybe just show the option of putting the existing application on a thread spawned from the model fn. What are your thoughts? |
Yeah I think this is much more reasonable in the case of a physics engine! I don't think the physics engine gains anything in particular from running on the main thread - it should in theory be simple to move something like that onto another thread. Yeah I agree maybe a demo of spawning a thread like this for processing that you don't want to block the main app thread would be useful? It would be more of a problem if the user already had their own application loop and windows running, and wanted to run an instance of nannou side-by-side for some reason, maybe in a separate window or something. I don't think there's any way you could let both the original application and the nannou application run on the main thread (which would be necessary on macos) - they'd have to run as separate processes I think. Checking out that stackoverflow issue, it looks like the user had checked out an example that only used the The Create A Project chapter and the first basics tutorial of the guide both demonstrate the more flexible yet slightly more verbose Perhaps another approach for solving the case that this user ran into is to more visibly demonstrate that there are two ways to start a nannou project, |
So a question / confusion I have noticed is that people are stuck on how do they add nannou to an existing application. Do they have to change the whole structure of their app to use nannou.
I think a good solution is to just spin nannou up on another thread and then communicate with it using channels but it could be cool to have an example of how this would look.
The text was updated successfully, but these errors were encountered: