public void releaseCurrentContext() { if (_context.equals(GLContext.getCurrent())) { try { _context.release(); } catch (final GLException gle) { gle.printStackTrace(); } } }
@Override public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); } } final int err = CGL.CGLSetCurrentContext(0); if(DEBUG && CGL.kCGLNoError != err) { System.err.println("CGL: Could not release current context: err 0x"+Integer.toHexString(err)+": "+this); } final int err2 = CGL.CGLUnlockContext(ctx); if(DEBUG && CGL.kCGLNoError != err2) { System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err2)+": "+this); } return CGL.kCGLNoError == err && CGL.kCGLNoError == err2; }
/** * Returns the shared resource mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}, * either a pre-existing or newly created, or <code>null</code> if creation failed or not supported.<br> * Creation of the shared resource is tried only once. * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device. */ protected final SharedResourceRunner.Resource getOrCreateSharedResource(AbstractGraphicsDevice device) { try { device = validateDevice(device); if( null != device) { return getOrCreateSharedResourceImpl( device ); } } catch (final GLException gle) { if(DEBUG) { System.err.println("Caught exception on thread "+getThreadName()); gle.printStackTrace(); } } return null; } protected abstract SharedResourceRunner.Resource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device);
/** * Returns the maximum number of FBO RENDERBUFFER samples * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. */ public final int getMaxRenderbufferSamples() { if( hasFullFBOSupport() ) { final GL gl = getGL(); final int[] val = new int[] { 0 } ; try { gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0); final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR == glerr) { return val[0]; } else if(DEBUG) { System.err.println("GLContext.getMaxRenderbufferSamples: GL_MAX_SAMPLES query GL Error 0x"+Integer.toHexString(glerr)); } } catch (final GLException gle) { gle.printStackTrace(); } } return 0; }
@Override public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); } } final boolean res = CGL.clearCurrentContext(ctx); final long cglCtx = CGL.getCGLContext(ctx); if(0 == cglCtx) { throw new InternalError("Null CGLContext for: "+this); } final int err = CGL.CGLUnlockContext(cglCtx); if(DEBUG && CGL.kCGLNoError != err) { System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err)+": "+this); } return res && CGL.kCGLNoError == err; }
} catch (final GLException gle) { System.err.println("Caught exception on thread "+Thread.currentThread().getName()); gle.printStackTrace();
System.err.println(joglVersion.toString()); System.err.println(JoglVersion.getGLInfo(gl, null)); e.printStackTrace();
value = _context.makeCurrent(); } catch (final GLException gle) { gle.printStackTrace(); } finally { attempt++;
} catch (final GLException gle) { if(DEBUG) { gle.printStackTrace();
} catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace();
gl.glGetIntegerv(GL2ES2.GL_MAX_COLOR_ATTACHMENTS, val, 0); realMaxColorAttachments = 1 <= val[0] ? val[0] : 1; // cap minimum to 1 } catch (final GLException gle) { gle.printStackTrace(); }
private void destroySharedGL() { if( null != sharedGLCtx ) { if( sharedGLCtx.isCreated() ) { // Catch dispose GLExceptions by GLEventListener, just 'print' them // so we can continue with the destruction. try { sharedGLCtx.destroy(); } catch (final GLException gle) { gle.printStackTrace(); } } sharedGLCtx = null; } if( null != dummyDrawable ) { final AbstractGraphicsDevice device = dummyDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); dummyDrawable.setRealized(false); dummyDrawable = null; device.close(); } }
if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent caught exception:"); gle.printStackTrace(); if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:"); gle.printStackTrace();
if( DEBUG ) { System.err.println("Caught: "+gle.getMessage()); gle.printStackTrace();
if( DEBUG ) { System.err.println("Caught: "+gle.getMessage()); gle.printStackTrace();
if( DEBUG ) { System.err.println("Caught: "+gle.getMessage()); gle.printStackTrace();
try { gl.glReadPixels(inX, inY, width, height, pixelAttribs.format, pixelAttribs.type, readPixelBuffer.buffer); } catch(final GLException gle) { res = false; gle.printStackTrace(); } readPixelBuffer.position( readPixelSize ); readPixelBuffer.flip();