diff options
author | Sven Gothel <[email protected]> | 2010-04-20 11:46:26 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-20 11:46:26 +0200 |
commit | 32790c376583beccd030eecd7c56cbe66d380172 (patch) | |
tree | 894613c7fc6a598aed59db87e5812ef6a44b83dd /src/newt/native | |
parent | aa7084700bbf74d8bcc98cf0239f57cff2983423 (diff) |
JOGL GL4 preperation (cont):
- All available OpenGL versions (native/platform) are verified at GLProfile
initialization and can be queried ..
A mapping of major,compat -> major,minor,options is created.
- Removal of temp context creation, when creating a context.
This was necessary to query general availability of ARB_create_context.
Due to the shared context of X11GLXDrawableFactory and WindowsWGLDrawableFactory,
this is no more necessary.
Due to the version mapping, the ARB_create_context paramters are known.
- NativeWindow X11Lib: Added X11ErrorHandler, throwing a RuntimeException.
Necessary to catch BadMatch .. etc X11 errors, eg for glXCreateContextAttribsARB
Hence all X11 calls are covered now.
- X11DummyGLXDrawable needs to use an own Window, otherwise GLn n>2 fails
- Flattening the desktop GL* implementation,
all use GL4bcImpl, which reduces the footprint dramatically.
- GL*Impl.isGL*() (desktop) utilizes the GLContext.isGL*(),
hence the results reflect the actual native context version.
- GLContextImpl makeCurrent/create: Added workflow documentation,
clarified code, defined abstract methods to have a protocol.
- Removed moved files (from here to gluegen),
see gluegen a01cb3d59715a41153380f1977ec75263b762dc6
- NativeLibLoader -> <TYPE>JNILibLoader
- Fixed Exception Handling (as in gluegen bce53b52c8638729750c4286dbc04cb14329fd34),
ie removed empty catch Throwable ..
- GLContext.setSwapInterval(): Nop in offscreen case, otherwise X11IOError (NVIDIA Bug)
Test:
Tests
- Junit
- demos.gears.Gears
- demos.jrefract.JRefract
Platforms
- Linux 64/32 ATI/NVidia
- MacOsX
- Windows (virtualbox 3.1.6, offscreen failed)
TODO/BUGS:
- FIXME ATI GLn n>2 with AWT, can't make context current, works well on NVIDIA though
- FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available!
- Add GL 3.3 to GL3/gl3ext.h
- Add GL 4.0 to GL3/gl3ext.h and fix the GL3/GL4 seperation
- Rename jogl.gl2.jar -> jogl.gldesktop.jar (as done with it's native lib already)
Diffstat (limited to 'src/newt/native')
-rwxr-xr-x | src/newt/native/X11Window.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 33c5324e2..296172f6e 100755 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -159,11 +159,11 @@ static void _FatalError(JNIEnv *env, const char* msg, ...) va_end(ap); fprintf(stderr, buffer); + fprintf(stderr, "\n"); (*env)->FatalError(env, buffer); } -static const char * const ClazzNameRuntimeException = - "java/lang/RuntimeException"; +static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException"; static jclass runtimeExceptionClz=NULL; static const char * const ClazzNameNewtWindow = @@ -200,6 +200,7 @@ static void _throwNewRuntimeException(Display * unlockDisplay, JNIEnv *env, cons */ +static JNIEnv * x11ErrorHandlerJNIEnv = NULL; static XErrorHandler origErrorHandler = NULL ; static int displayDispatchErrorHandler(Display *dpy, XErrorEvent *e) @@ -213,15 +214,16 @@ static int displayDispatchErrorHandler(Display *dpy, XErrorEvent *e) { fprintf(stderr, " BadWindow (%p): Window probably already removed\n", e->resourceid); } else { - return origErrorHandler(dpy, e); + _throwNewRuntimeException(NULL, x11ErrorHandlerJNIEnv, "NEWT X11 Error: Display %p, Code 0x%X", dpy, e->error_code); } return 0; } -static void displayDispatchErrorHandlerEnable(int onoff) { +static void displayDispatchErrorHandlerEnable(int onoff, JNIEnv * env) { if(onoff) { if(NULL==origErrorHandler) { + x11ErrorHandlerJNIEnv = env; origErrorHandler = XSetErrorHandler(displayDispatchErrorHandler); } } else { @@ -329,13 +331,13 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_CompleteDisplay javaObjectAtom = (jlong) XInternAtom(dpy, "JOGL_JAVA_OBJECT", False); if(None==javaObjectAtom) { - _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!"); return; } windowDeleteAtom = (jlong) XInternAtom(dpy, "WM_DELETE_WINDOW", False); if(None==windowDeleteAtom) { - _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!"); return; } @@ -371,7 +373,7 @@ static void setJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, jlon { jobject test = (jobject) getPtrOut32Long(jogl_java_object_data); if( ! (jwindow==test) ) { - _throwNewRuntimeException(dpy, env, "Internal Error .. Encoded Window ref not the same %p != %p !\n", jwindow, test); + _throwNewRuntimeException(dpy, env, "Internal Error .. Encoded Window ref not the same %p != %p !", jwindow, test); return; } } @@ -415,7 +417,7 @@ static jobject getJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, j #ifdef VERBOSE_ON if(JNI_FALSE == (*env)->IsInstanceOf(env, jwindow, newtWindowClz)) { - _throwNewRuntimeException(dpy, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !\n", jwindow); + _throwNewRuntimeException(dpy, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !", jwindow); } #endif return jwindow; @@ -457,20 +459,20 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_DispatchMessages num_events--; if( 0==evt.xany.window ) { - _throwNewRuntimeException(dpy, env, "event window NULL, bail out!\n"); + _throwNewRuntimeException(dpy, env, "event window NULL, bail out!"); return ; } if(dpy!=evt.xany.display) { - _throwNewRuntimeException(dpy, env, "wrong display, bail out!\n"); + _throwNewRuntimeException(dpy, env, "wrong display, bail out!"); return ; } - displayDispatchErrorHandlerEnable(1); + displayDispatchErrorHandlerEnable(1, env); jwindow = getJavaWindowProperty(env, dpy, evt.xany.window, javaObjectAtom); - displayDispatchErrorHandlerEnable(0); + displayDispatchErrorHandlerEnable(0, env); if(NULL==jwindow) { fprintf(stderr, "Warning: NEWT X11 DisplayDispatch %p, Couldn't handle event %d for invalid X11 window %p\n", @@ -685,7 +687,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Window_CreateWindow } if(visualID<0) { - _throwNewRuntimeException(NULL, env, "invalid VisualID ..\n"); + _throwNewRuntimeException(NULL, env, "invalid VisualID .."); return 0; } @@ -712,7 +714,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Window_CreateWindow if (visual==NULL) { - _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!"); return 0; } @@ -797,11 +799,11 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_CloseWindow jwindow = getJavaWindowProperty(env, dpy, w, javaObjectAtom); if(NULL==jwindow) { - _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!\n"); + _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!"); return; } if ( JNI_FALSE == (*env)->IsSameObject(env, jwindow, obj) ) { - _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!\n"); + _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!"); return; } (*env)->DeleteGlobalRef(env, jwindow); |