aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-05 14:32:48 +0200
committerSven Gothel <[email protected]>2012-07-05 14:32:48 +0200
commita26d6e9361fb3287cba053aaf1a6318c853da95a (patch)
tree61b60de672b893ee35d07a03e95d9f8f816bb59b
parentfd06292d4a208cbd613f4bdce7cae12e075e70ec (diff)
NEWT/KD Adapt to 'new' KD Window Creation API, use EGLConfig
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/KDWindow.java10
-rw-r--r--src/newt/native/KDWindow.c21
2 files changed, 10 insertions, 21 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java b/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java
index d34ffd593..bb76d21ff 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java
@@ -37,6 +37,7 @@ package jogamp.newt.driver.kd;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.VisualIDHolder.VIDType;
import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -66,11 +67,12 @@ public class KDWindow extends WindowImpl {
setGraphicsConfiguration(cfg);
GLCapabilitiesImmutable eglCaps = (GLCapabilitiesImmutable) cfg.getChosenCapabilities();
- int[] eglAttribs = EGLGraphicsConfiguration.GLCapabilities2AttribList(eglCaps);
+ int eglConfigID = eglCaps.getVisualID(VIDType.EGL_CONFIG);
+ long eglConfig = EGLGraphicsConfiguration.EGLConfigId2EGLConfig(getDisplayHandle(), eglConfigID);
- eglWindowHandle = CreateWindow(getDisplayHandle(), eglAttribs);
+ eglWindowHandle = CreateWindow(getDisplayHandle(), eglConfig);
if (eglWindowHandle == 0) {
- throw new NativeWindowException("Error creating egl window: "+cfg);
+ throw new NativeWindowException("Error creating egl window: "+cfg+", eglConfigID "+eglConfigID+", eglConfig 0x"+Long.toHexString(eglConfig));
}
setVisible0(eglWindowHandle, false);
setWindowHandle(RealizeWindow(eglWindowHandle));
@@ -135,7 +137,7 @@ public class KDWindow extends WindowImpl {
//
protected static native boolean initIDs();
- private native long CreateWindow(long displayHandle, int[] attributes);
+ private native long CreateWindow(long displayHandle, long eglConfig);
private native long RealizeWindow(long eglWindowHandle);
private native int CloseWindow(long eglWindowHandle, long userData);
private native void setVisible0(long eglWindowHandle, boolean visible);
diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c
index dc999138c..5afe6fc7b 100644
--- a/src/newt/native/KDWindow.c
+++ b/src/newt/native/KDWindow.c
@@ -42,6 +42,7 @@
#include <gluegen_stdint.h>
#include <KD/kd.h>
+#include <EGL/egl.h>
#include "jogamp_newt_driver_kd_KDWindow.h"
@@ -208,11 +209,10 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_kd_KDWindow_initIDs
}
JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_kd_KDWindow_CreateWindow
- (JNIEnv *env, jobject obj, jlong display, jintArray jAttrs)
+ (JNIEnv *env, jobject obj, jlong display, jlong jeglConfig)
{
- jint * attrs = NULL;
- jsize attrsLen;
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
+ EGLConfig eglConfig = (EGLConfig)(intptr_t)jeglConfig;
KDWindow *window = 0;
if(dpy==NULL) {
@@ -220,22 +220,9 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_kd_KDWindow_CreateWindow
return 0;
}
- attrsLen = (*env)->GetArrayLength(env, jAttrs);
- if(0==attrsLen) {
- fprintf(stderr, "[CreateWindow] attribute array size 0..\n");
- return 0;
- }
- attrs = (*env)->GetIntArrayElements(env, jAttrs, 0);
- if(NULL==attrs) {
- fprintf(stderr, "[CreateWindow] attribute array NULL..\n");
- return 0;
- }
-
JOGLKDUserdata * userData = kdMalloc(sizeof(JOGLKDUserdata));
userData->magic = JOGL_KD_USERDATA_MAGIC;
- window = kdCreateWindow(dpy, attrs, (void *)userData);
-
- (*env)->ReleaseIntArrayElements(env, jAttrs, attrs, 0);
+ window = kdCreateWindow(dpy, eglConfig, (void *)userData);
if(NULL==window) {
kdFree(userData);