diff options
author | Sven Gothel <[email protected]> | 2013-01-26 05:52:24 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-01-26 05:52:24 +0100 |
commit | e6ccafabb8fefa2381e7c102ca9cba4ef7555035 (patch) | |
tree | da4c329cea441146ebea8f52f289acb73b3110b4 /src/jogl/classes | |
parent | 9505d48f1702e2ba8c9e72edcbb8fab5ad01bc56 (diff) |
[EGL/X11]Context: Enhance DEBUG output for failed makeCurrentImpl(..)
Diffstat (limited to 'src/jogl/classes')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 21 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java | 9 |
2 files changed, 20 insertions, 10 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 572888bae..1c0cd0d3c 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -113,9 +113,14 @@ public abstract class EGLContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { if (EGL.eglGetCurrentContext() != contextHandle) { - if (!EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException("Error making context 0x" + - Long.toHexString(contextHandle) + " current: error code 0x" + Integer.toHexString(EGL.eglGetError())); + final long dpy = drawable.getNativeSurface().getDisplayHandle(); + if (!EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { + throw new GLException("Error making context " + toHexString(contextHandle) + + " current on Thread " + getThreadName() + + " with display " + toHexString(dpy) + + ", drawableWrite " + toHexString(drawable.getHandle()) + + ", drawableRead "+ toHexString(drawableRead.getHandle()) + + " - Error code " + toHexString(EGL.eglGetError()) + ", " + this); } } } @@ -123,8 +128,8 @@ public abstract class EGLContext extends GLContextImpl { @Override protected void releaseImpl() throws GLException { if (!EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT)) { - throw new GLException("Error freeing OpenGL context 0x" + - Long.toHexString(contextHandle) + ": error code 0x" + Integer.toHexString(EGL.eglGetError())); + throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) + + ": error code " + toHexString(EGL.eglGetError())); } } @@ -133,8 +138,8 @@ public abstract class EGLContext extends GLContextImpl { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle)) { final int eglError = EGL.eglGetError(); if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */ - throw new GLException("Error destroying OpenGL context 0x" + - Long.toHexString(contextHandle) + ": error code 0x" + Integer.toHexString(eglError)); + throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) + + ": error code " + toHexString(eglError)); } } } @@ -167,7 +172,7 @@ public abstract class EGLContext extends GLContextImpl { try { // might be unavailable on EGL < 1.2 if(!EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API)) { - throw new GLException("Catched: eglBindAPI to ES failed , error 0x"+Integer.toHexString(EGL.eglGetError())); + throw new GLException("Catched: eglBindAPI to ES failed , error "+toHexString(EGL.eglGetError())); } } catch (GLException glex) { if (DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index c2b66801e..feda64f30 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -403,9 +403,14 @@ public abstract class X11GLXContext extends GLContextImpl { protected void makeCurrentImpl() throws GLException { long dpy = drawable.getNativeSurface().getDisplayHandle(); - if (GLX.glXGetCurrentContext() != contextHandle) { + if (GLX.glXGetCurrentContext() != contextHandle) { if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { - throw new GLException(getThreadName()+": Error making context current: "+this); + throw new GLException("Error making context " + toHexString(contextHandle) + + " current on Thread " + getThreadName() + + " with display " + toHexString(dpy) + + ", drawableWrite " + toHexString(drawable.getHandle()) + + ", drawableRead "+ toHexString(drawableRead.getHandle()) + + " - " + this); } } } |