@Override public void display(GLAutoDrawable arg0) { getGL().getGL2().glClear(GL2.GL_COLOR_BUFFER_BIT); controller.updateTest(); getGL().glFlush(); }
public void flushGraphics() { final GL gl = GLContext.getCurrentGL(); gl.glFlush(); }
@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; }
@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; }
public void flushFrame(final boolean doSwap) { final GL gl = GLContext.getCurrentGL(); renderBuckets(); gl.glFlush(); if (doSwap) { doApplyState(defaultStateList.get(RenderState.StateType.ColorMask)); if (Constants.stats) { StatCollector.startStat(StatType.STAT_DISPLAYSWAP_TIMER); } checkCardError(); GLContext.getCurrent().getGLDrawable().swapBuffers(); if (Constants.stats) { StatCollector.endStat(StatType.STAT_DISPLAYSWAP_TIMER); } } if (Constants.stats) { StatCollector.addStat(StatType.STAT_FRAMES, 1); } }
@Override public final void swapBuffers() throws GLException { if( !realized ) { // volatile OK (locked below) return; // destroyed already } final int lockRes = lockSurface(); // it's recursive, so it's ok within [makeCurrent .. release] if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) { return; } try { if( realized ) { // volatile OK final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)surface.getGraphicsConfiguration().getChosenCapabilities(); if ( caps.getDoubleBuffered() ) { if(!surface.surfaceSwap()) { swapBuffersImpl(true); } } else { final GLContext ctx = GLContext.getCurrent(); if(null!=ctx && ctx.getGLDrawable()==this) { ctx.getGL().glFlush(); } swapBuffersImpl(false); } } } finally { unlockSurface(); } surface.surfaceUpdated(this, surface, System.currentTimeMillis()); }