lwjgl icon indicating copy to clipboard operation
lwjgl copied to clipboard

Allow using lwjgl without display mode extension

Open letmaik opened this issue 12 years ago • 11 comments

I'm trying to get lwjgl running on a headless server with xvfb/Mesa, mainly for continuous integration (Travis CI). The problem is that neither Xrandr nor XF86VidMode are available which is perfectly fine as I do offscreen rendering anyway.

Is it possible to offer a system property where one can say whether it's allowed to run without display mode extension? Similar to org.lwjgl.opengl.Display.allowSoftwareOpenGL=true.

letmaik avatar Jan 28 '13 19:01 letmaik

@neothemachine, I am trying to get LWJGL running in Travis CI as well; were you able to figure out a workaround?

virtuoushub avatar Dec 13 '14 22:12 virtuoushub

Sorry no, in the end I switched to JOGL.

letmaik avatar Dec 14 '14 16:12 letmaik

no updates for this? I am trying to do some work on Amazon G2 GPU instance. It feels that I have similar issue - org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes throw null pointer exception when setting up application, while glxgears works perfectly so GLX and OpenGL is working fine.

martunta avatar Jul 01 '15 21:07 martunta

I'm afraid LWJGL 2 is not actively maintained anymore. Other than critical bug fixes, there won't be any features added, unless someone submits a pull request.

For this particular case, my recommendation would be to use LWJGL 3. I have used it on an Amazon GPU instance with no issues. LWJGL 3 uses GLFW for windows/contexts, which is much more robust than the Display implementation in LWJGL 2.

Spasi avatar Jul 02 '15 07:07 Spasi

My apologies for repurposing this (old) issue for a question. I am working with LWJGL3 and was wondering how you (@Spasi) set it up to work in headless mode. Is any of this documented somehwere?

edwinRNDR avatar Jul 31 '18 09:07 edwinRNDR

GLFW has GLFW_OSMESA_CONTEXT_API now, which you can use in glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_OSMESA_CONTEXT_API). It is meant to be used for headless rendering.

You will also find useful information in the GLFW issues related to headless.

Spasi avatar Jul 31 '18 13:07 Spasi

@Spasi I ended up using LWJGL's EGL bindings as OSMesa only provides software rendering using the OpenGL 2.x API

edwinRNDR avatar Aug 01 '18 16:08 edwinRNDR

@edwinRNDR Would you be able to post a sample of this working?

MadcowD avatar Oct 31 '19 18:10 MadcowD

@MadcowD I have some code from a larger codebase that comes with an EGL back-end, you can find it here: https://github.com/openrndr/openrndr/blob/master/openrndr-gl3/src/main/kotlin/org/openrndr/internal/gl3/ApplicationEGLGL3.kt

edwinRNDR avatar Nov 01 '19 07:11 edwinRNDR

@edwinRNDR how did you avoid using GLFW?

MadcowD avatar Nov 01 '19 13:11 MadcowD

@MadcowD you create the GL context using EGL, like in the code I linked prior.

edwinRNDR avatar Nov 01 '19 16:11 edwinRNDR