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

Create a "headless" example (an example that demonstrates an application with no windows) #209

Open
mitchmindtree opened this issue Nov 4, 2018 · 6 comments

Comments

@mitchmindtree
Copy link
Member

We shouldn't make the assumption that the user always wants one or more windows - there are plenty of applications where the user might only want to use audio, lasers, etc.

This will involve tweaking some internals, and perhaps separating all of the windowing logic and user input event loop from the App type. I've been meaning to do a refactor of the App type so it could be useful to consider this issue while doing so.

@mitchmindtree
Copy link
Member Author

It would be nice if nannou could still provide raw keyboard and mouse events in a "headless" context, as these might be useful for interacting with alternative displays like LED arrays, laser projectors, etc. This would require creating a winit::EventLoop instance, but without actually building any windows. I know that some backends support raw device events (device events unassociated with particular windows) but I haven't tested each of them to know for sure. Perhaps the EventLoop can be lazily initialized only if one of these input functions are requested? In the case that no input function is requested, we can assume the EventLoop is not needed.

I imagine the API would still be quite similar - the model function would still be necessary for setup and Model initialisation, and would allow for spawning these alternate outputs etc.

The vulkan instance should still be available in case the user wishes to do some form of image processing or GPU compute.

@tmladek
Copy link

tmladek commented Nov 18, 2020

Hello, any news on this issue? :)

From my reading of the docs and a couple brief attempts, it would seem that nannou doesn't yet support headless Apps...

@mitchmindtree
Copy link
Member Author

Hey @tmladek, that's correct, we're still in the same state. My previous comment mentions some ideas on how we might be able to make some progress here if anyone is interested in contributing. Otherwise I'm sure we'll get around to this at some point, it just hasn't had high enough priority for us to focus on this just yet.

Another idea - Before trying to work on a solution in nannou itself, I think I would first try to land a headless.rs example in winit (the library nannou uses to manage windowing and input device events) that demonstrates a program that continues to receive device input (e.g. mouse and keyboard), but does not need a window to do so. Once that can be shown to work nicely in a cross platform manner, it should be trivial to land headless support in nannou.

@bitzl
Copy link

bitzl commented Sep 12, 2022

To add another potential use case: I'm currently looking for a general way to render video without displaying it in real time so rendering an one hour video doesn't take one hour.

@merlindru
Copy link

@bitzl Shouldn't that be possible already? You'd advance by one frame for each of your video, capture it (see #187), and then stitch it together into a video file

@melMass
Copy link

melMass commented Dec 29, 2023

@merlindru This still requires a window or I missed a point in the link?

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

5 participants