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

Does GLFW support creating OpenGL contexts for headless rendering (to an offscreen buffer)? #648

Closed
dmitshur opened this issue Nov 23, 2015 · 17 comments
Assignees
Labels
Milestone

Comments

@dmitshur
Copy link
Collaborator

@dmitshur dmitshur commented Nov 23, 2015

GLFW is described as:

GLFW is an Open Source, multi-platform library for creating windows with OpenGL contexts and receiving input and events.

I've looked through the documentation, the FAQ, and issues, but could not find an answer to this.

Does GLFW support creating an OpenGL context in a "headless" mode? For rendering to an offscreen buffer and perhaps writing generated images to disk or using it in some other way.

This is not a feature request, it's a question. Asking on behalf of goxjs/gl#12 (comment).

@dmitshur dmitshur mentioned this issue Nov 23, 2015
@slimsag

This comment has been minimized.

Copy link

@slimsag slimsag commented Nov 23, 2015

#525 has some relevant info for using a hidden window.

AFAIK doing headless rendering without a hidden window is not really possible due to how tightly coupled GL is with most windowing systems.

@dmitshur

This comment has been minimized.

Copy link
Collaborator Author

@dmitshur dmitshur commented Nov 23, 2015

Thanks. It turns out it was there in the docs but I missed it, sorry.

http://www.glfw.org/docs/latest/context.html#context_offscreen

@dmitshur dmitshur closed this Nov 23, 2015
@elmindreda elmindreda added the question label Nov 23, 2015
@elmindreda elmindreda added this to the milestone Nov 23, 2015
@elmindreda elmindreda self-assigned this Nov 23, 2015
@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Nov 23, 2015

@shurcooL Where did you look? Perhaps I should add a link.

@dmitshur

This comment has been minimized.

Copy link
Collaborator Author

@dmitshur dmitshur commented Nov 27, 2015

I looked here and here, but I forgot to check here.

I think it's fine. Perhaps it's worth adding as a FAQ if you think it is.

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Nov 27, 2015

Yes, the FAQ is a great place. Thank you!

@RobotCaleb

This comment has been minimized.

Copy link

@RobotCaleb RobotCaleb commented Jan 27, 2017

With EGL and osmesa support is the following still true?
GLFW doesn't support creating contexts without an associated window. However, contexts with hidden windows can be created with the GLFW_VISIBLE window hint.

I need GPU accelerated headless contexts. Please move to a new issue if this isn't a good spot for this question.

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Jan 27, 2017

@RobotCaleb How headless do you need it and on what platforms? Do you mean without requiring the window system to be running, or just without creating a hidden window?

@RobotCaleb

This comment has been minimized.

Copy link

@RobotCaleb RobotCaleb commented Jan 27, 2017

It needs to be on a system without X running. It seems EGL supports this but my first test was by providing the EGL hint to the window creation, but that just created a window. Which makes sense.

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Jan 30, 2017

@RobotCaleb There is no support in GLFW for accelerated headless rendering at the moment. There is an OSMesa / no-op backend and I will soon merge an EGLDevice / Linux backend (you can find it in the egldevice branch).

@RobotCaleb

This comment has been minimized.

Copy link

@RobotCaleb RobotCaleb commented Jan 30, 2017

@elmindreda Thanks for the info. I'll look through the code in egldevice. Will this be enough to have accelerated headless rendering or will I need to look into adding that functionality?

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Jan 30, 2017

@RobotCaleb It's enough, but only on drivers that support it. I think it's still Nvidia only.

@RobotCaleb

This comment has been minimized.

Copy link

@RobotCaleb RobotCaleb commented Jan 30, 2017

Outstanding, thanks for the info. I'm eager to check it out. If I have any further questions I'll put them in a new issue.

@devshgraphicsprogramming

This comment has been minimized.

Copy link

@devshgraphicsprogramming devshgraphicsprogramming commented Oct 30, 2018

@RobotCaleb the problem is that you must have a legacy gl window to query support for core 3.2 context creation functions... so X11 is necessary in this chain.

Has anyone tried pbuffers? It wont absolve you of X11 but at least you will get a window-less context after the start-up (unless this is what GLFW hidden window actually is).

OpenGL 3.2 core spec actually allows for context with no drawable, you'll just get an invalid default framebuffer object.

@MadcowD

This comment has been minimized.

Copy link

@MadcowD MadcowD commented Jun 10, 2019

Can anyone tell me how this is done now?

@slimsag

This comment has been minimized.

Copy link

@slimsag slimsag commented Jun 10, 2019

@harlowja

This comment has been minimized.

Copy link

@harlowja harlowja commented Jun 20, 2019

Did the egldevice branch merge? Seems like it has a bunch of code that never made it in :(

@elmindreda

This comment has been minimized.

Copy link
Member

@elmindreda elmindreda commented Jul 1, 2019

@harlowja Not yet, please follow #786 for updates.

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

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.