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

Headless rendering (modernGL) pipes into Syphon server #72

Open
oogre opened this issue Jun 13, 2022 · 1 comment
Open

Headless rendering (modernGL) pipes into Syphon server #72

oogre opened this issue Jun 13, 2022 · 1 comment

Comments

@oogre
Copy link

oogre commented Jun 13, 2022

Hello,
I'm working on a live video modular synthetizer since few years.
With that perspective, I'm looking for solution to make its development easier,
by splitting engine and UI. In fact, I want to explode the core engine into multiple simple modules,
each of them connected with syphon to exchange visuals and other protocols to exchange controls.

ModerGL looks like the solution to generate live visuals,
and syphonpy looks like to be the only python solution to handle syphon pipe.

Here's a simpler setup to debug things.

import syphonpy
import moderngl
from ported._example import Example

class EasySyphon(Example):
    gl_version = (3, 3)
    title = "easySyphon"

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.server = syphonpy.SyphonServer("headlessTest2")
        self.fbo = self.ctx.framebuffer(
            color_attachments=[self.ctx.texture((512, 512), 4)]
        )

    def render(self, time: float, frame_time: float):
        self.fbo.clear(1.0, 0.0, 0.0, 1.0)   
        viewPort = syphonpy.MakeRect(0,0,self.fbo.width,self.fbo.height)
        size = syphonpy.MakeSize(self.fbo.width,self.fbo.height)
        self.server.publish_frame_texture(self.fbo.glo, viewPort, size, False)

if __name__ == '__main__':
    EasySyphon.run()

I run

python3 EasySyphon.py

it works... the video output is piped to syphon which is what I need, the window build by moderGL is full white.
but I want to run it headless. so

I run

python3 EasySyphon.py --window headless

it does not work. the syphon server looks to be created,
but nothing is displayed into syphon recorder(which I use to visualize the rendering)
later as debug, I saved the rendering FBO to a png file to isolate the bug origin,
this worked without any troubble,

I'm not sure how syphon/syphonpy interacts with the opengl context to be honest.
It might be realteed to this? Does it detect a context on server creation or something?

does anyone here've a bit of advice?
Thanks for reading me.

@vade
Copy link
Member

vade commented Jan 6, 2023

Hi

So, quickly - Syphon has no care about headless or not. This sounds like an issue with syphonpy project. My suspicion is that there is no CFRunloop created when running headless based on whatever tooling is going on!

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