From f4281b5ee80d7674134bfee357695a98382884a3 Mon Sep 17 00:00:00 2001 From: Erik De Rijcke Date: Wed, 6 May 2015 16:30:42 +0200 Subject: detect gbm platform on linux when no other display server is running --- .../classes/jogamp/opengl/egl/EGLDisplayUtil.java | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index fcd4f54eb..5adba1703 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -44,6 +44,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.LongObjectHashMap; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.egl.EGL; +import com.jogamp.opengl.egl.EGLExt; /** * This implementation provides recursive calls to @@ -196,7 +197,27 @@ public class EGLDisplayUtil { } return singletonEGLDisplay.eglDisplay; } - final long eglDisplay = EGL.eglGetDisplay(nativeDisplay_id); + + final String nativeWindowType = NativeWindowFactory.getNativeWindowType(false); + int platform = 0; + final long eglDisplay; + if(nativeWindowType == NativeWindowFactory.TYPE_X11) { + platform = EGLExt.EGL_PLATFORM_X11_KHR; + }else if(nativeWindowType == NativeWindowFactory.TYPE_ANDROID) { + platform = EGLExt.EGL_PLATFORM_ANDROID_KHR; + }else if(nativeWindowType == NativeWindowFactory.TYPE_GBM){ + platform = EGLExt.EGL_PLATFORM_GBM_MESA; + } else if(nativeWindowType == NativeWindowFactory.TYPE_WAYLAND){ + // TODO + platform = EGLExt.EGL_PLATFORM_WAYLAND_KHR; + } + if( platform != 0){ + eglDisplay = EGL.eglGetPlatformDisplay(platform, nativeDisplay_id, null); + } + else{ + eglDisplay = EGL.eglGetDisplay(nativeDisplay_id); + } + if(DEBUG) { System.err.println("EGLDisplayUtil.eglGetDisplay.X: eglDisplay("+EGLContext.toHexString(nativeDisplay_id)+"): "+ EGLContext.toHexString(eglDisplay)+ -- cgit v1.2.3