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

Possibly add a separate headless_egl window #130

Open
einarf opened this issue Mar 13, 2021 · 3 comments
Open

Possibly add a separate headless_egl window #130

einarf opened this issue Mar 13, 2021 · 3 comments
Milestone

Comments

@einarf
Copy link
Member

einarf commented Mar 13, 2021

Since moderngl-window are doing the context creation we might need to add a separate window for egl. Optionally the current headless window should be more configurable.

@einarf einarf changed the title Possibly add a separate healdess_egl window Possibly add a separate headless_egl window Mar 14, 2021
@kngwyu
Copy link

kngwyu commented Apr 26, 2022

The below code works for me

class EglHeadlessWindow(headless.Window):
    name = "egl-headless"

    def init_mgl_context(self) -> None:
        """Create an standalone context and framebuffer"""
        self._ctx = mgl.create_standalone_context(
            require=self.gl_version_code,
            backend="egl",
        )
        self._fbo = self.ctx.framebuffer(
            color_attachments=self.ctx.texture(self.size, 4, samples=self._samples),
            depth_attachment=self.ctx.depth_texture(self.size, samples=self._samples),
        )
        self.use()

Though I'm not sure what is the best interface to use this. The only thing I want to do is to pass backend="egl", and I guess most users do too.

@einarf
Copy link
Member Author

einarf commented Apr 26, 2022

That is a perfectly fine way to do it. Optionally you can just monkeypatch the method in the headless window itself. There might be several other context creation parameters people want to supply here as well.

@kngwyu
Copy link

kngwyu commented Apr 26, 2022

Hmm then window_cls(context_settings={"backend": "egl"}) might be a good interface

@einarf einarf added this to the 3.0 milestone Oct 14, 2023
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