diff options
author | Sven Gothel <[email protected]> | 2015-01-23 23:34:39 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-01-23 23:34:39 +0100 |
commit | 26f965bbe7b40968158901c3f4ef2f54e821ac70 (patch) | |
tree | 398470d31a63df04451de683572ee31f2e72dae6 /src/jogl/classes/jogamp/opengl/windows/wgl | |
parent | b4991d6ed202963ea66456b0abbcb1698f2712da (diff) |
GLContextImpl.makeCurrentImpl(): Remove redundant test whether context is already current
- GLContextImpl.makeCurrentImpl(): Remove redundant test whether context is already current
GLContext.makeCurrent() already verifies whether native makeCurrent can be skipped
by comparing against the thread-local current GLContext instance.
- Add X11GLXContext.glXReleaseContext(..) to simplify release call
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index c9d78b116..131187a4d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -160,20 +160,19 @@ public class WindowsWGLContext extends GLContextImpl { return ok; } - private final boolean wglReleaseContext(final long ctx) { + private final boolean wglReleaseContext() { boolean ok = false; if(wglGLReadDrawableAvailable) { // needs initilized WGL ProcAddress table - ok = getWGLExt().wglMakeContextCurrent(0, 0, ctx); + ok = getWGLExt().wglMakeContextCurrent(0, 0, 0); } else { - ok = WGL.wglMakeCurrent(0, ctx); + ok = WGL.wglMakeCurrent(0, 0); } if( !ok ) { final int werr = GDI.GetLastError(); final boolean ok2 = werr == GDI.ERROR_SUCCESS; if(DEBUG) { - final Throwable t = new Throwable ("Info: wglReleaseContext NOK: ctx " + GLContext.toHexString(ctx) + - ", werr " + werr + " -> ok "+ok2); + final Throwable t = new Throwable ("Info: wglReleaseContext NOK: werr " + werr + " -> ok "+ok2); t.printStackTrace(); } // Some GPU's falsely fails with a zero error code (success), @@ -417,20 +416,18 @@ public class WindowsWGLContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { - if (WGL.wglGetCurrentContext() != contextHandle) { - if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { + if ( !wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) { throw new GLException("Error making context " + toHexString(contextHandle) + " current on Thread " + getThreadName() + ", drawableWrite " + toHexString(drawable.getHandle()) + ", drawableRead "+ toHexString(drawableRead.getHandle()) + ", werr: " + GDI.GetLastError() + ", " + this); } - } } @Override protected void releaseImpl() throws GLException { - if (!wglReleaseContext(0)) { + if ( !wglReleaseContext() ) { throw new GLException("Error freeing OpenGL context, werr: " + GDI.GetLastError()); } } |