aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-09 17:07:02 +0200
committerSven Gothel <[email protected]>2012-07-09 17:07:02 +0200
commit72a84b422327c6abb688339419d3552ec0e5c70c (patch)
treecb974b98f73bf930870c40f72d73ccec7ab995fe /src/newt/classes/jogamp
parent4e70a4811a860255b53eeae7a841ca473e1aba86 (diff)
EGLGraphicsDevice adds desctruction callback and nativeDisplayID; EGLDisplayUtil adds creation of EGLGraphicsDevice.
Due to EGL's location in JOGL, supporting destruction of an EGLGraphicsDevice is solved (hack) temporary by passing an eglTerminate callback to it's ctor. Using EGLGraphicsDevice's close() method to also issue eglTerminate() simplifies the code. In future we shall move EGL to nativewindow!
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/AndroidDisplay.java16
-rw-r--r--src/newt/classes/jogamp/newt/driver/broadcom/egl/Display.java4
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/KDDisplay.java15
3 files changed, 6 insertions, 29 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidDisplay.java b/src/newt/classes/jogamp/newt/driver/android/AndroidDisplay.java
index 3f360f20f..0a43c9b8f 100644
--- a/src/newt/classes/jogamp/newt/driver/android/AndroidDisplay.java
+++ b/src/newt/classes/jogamp/newt/driver/android/AndroidDisplay.java
@@ -32,9 +32,6 @@ import jogamp.newt.*;
import jogamp.opengl.egl.*;
import javax.media.nativewindow.*;
-import javax.media.opengl.GLException;
-
-import com.jogamp.nativewindow.egl.*;
public class AndroidDisplay extends jogamp.newt.DisplayImpl {
static {
@@ -55,20 +52,11 @@ public class AndroidDisplay extends jogamp.newt.DisplayImpl {
protected void createNativeImpl() {
// EGL Device
- final long eglDisplay = EGLDisplayUtil.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
- if (eglDisplay == EGL.EGL_NO_DISPLAY) {
- throw new GLException("Failed to created EGL default display: error 0x"+Integer.toHexString(EGL.eglGetError()));
- }
- if (!EGLDisplayUtil.eglInitialize(eglDisplay, null, null)) {
- throw new GLException("eglInitialize failed eglDisplay 0x"+Long.toHexString(eglDisplay)+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- }
- aDevice = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+ aDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
protected void closeNativeImpl() {
- if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) {
- EGLDisplayUtil.eglTerminate(aDevice.getHandle());
- }
+ aDevice.close();
}
protected void dispatchMessagesNative() {
diff --git a/src/newt/classes/jogamp/newt/driver/broadcom/egl/Display.java b/src/newt/classes/jogamp/newt/driver/broadcom/egl/Display.java
index f90c62ff4..e3f50b7e0 100644
--- a/src/newt/classes/jogamp/newt/driver/broadcom/egl/Display.java
+++ b/src/newt/classes/jogamp/newt/driver/broadcom/egl/Display.java
@@ -61,11 +61,11 @@ public class Display extends jogamp.newt.DisplayImpl {
}
protected void createNativeImpl() {
- long handle = CreateDisplay(Screen.fixedWidth, Screen.fixedHeight);
+ final long handle = CreateDisplay(Screen.fixedWidth, Screen.fixedHeight);
if (handle == EGL.EGL_NO_DISPLAY) {
throw new NativeWindowException("BC EGL CreateDisplay failed");
}
- aDevice = new EGLGraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+ aDevice = new EGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, handle, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT, null);
}
protected void closeNativeImpl() {
diff --git a/src/newt/classes/jogamp/newt/driver/kd/KDDisplay.java b/src/newt/classes/jogamp/newt/driver/kd/KDDisplay.java
index 73bbe0b5b..07b031841 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/KDDisplay.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/KDDisplay.java
@@ -42,8 +42,6 @@ import jogamp.newt.NEWTJNILibLoader;
import jogamp.opengl.egl.EGL;
import jogamp.opengl.egl.EGLDisplayUtil;
-import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
-
public class KDDisplay extends DisplayImpl {
static {
@@ -64,20 +62,11 @@ public class KDDisplay extends DisplayImpl {
protected void createNativeImpl() {
// FIXME: map name to EGL_*_DISPLAY
- long handle = EGLDisplayUtil.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
- if (handle == EGL.EGL_NO_DISPLAY) {
- throw new NativeWindowException("eglGetDisplay failed");
- }
- if (!EGLDisplayUtil.eglInitialize(handle, null, null)) {
- throw new NativeWindowException("eglInitialize failed");
- }
- aDevice = new EGLGraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+ aDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
protected void closeNativeImpl() {
- if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) {
- EGLDisplayUtil.eglTerminate(aDevice.getHandle());
- }
+ aDevice.close();
}
protected void dispatchMessagesNative() {