summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorErik De Rijcke <[email protected]>2015-05-06 16:30:42 +0200
committerSven Gothel <[email protected]>2019-11-21 03:28:50 +0100
commitf4281b5ee80d7674134bfee357695a98382884a3 (patch)
treee54ad95c7e67505d9605de2a988eed1350ed7f59 /src/jogl
parentcd07cb251ae2df8e8cfd455a91cbe7d5394a77e0 (diff)
detect gbm platform on linux when no other display server is running
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java23
1 files changed, 22 insertions, 1 deletions
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)+