@Override protected void initContextFirstTime(){ offscreenDrawable.getContext().makeCurrent(); try { super.initContextFirstTime(); } finally { offscreenDrawable.getContext().release(); } }
@Override boolean releaseCtx(Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.releaseCtx()"); GLContext context = context(ctx); context.release(); return true; }
private static void dumpGLInfo(final GLDrawableFactoryImpl factory, final AbstractGraphicsDevice device) { final GLContext ctx = factory.getOrCreateSharedContext(device); if(null != ctx) { System.err.println("GLProfile.dumpGLInfo: "+ctx); ctx.makeCurrent(); try { System.err.println(JoglVersion.getGLInfo(ctx.getGL(), null)); } finally { ctx.release(); } } else { System.err.println("GLProfile.dumpGLInfo: shared context n/a"); System.err.println(device.getClass().getSimpleName()+"[type "+ device.getType()+", connection "+device.getConnection()+"]:"); System.err.println(GLProfile.glAvailabilityToString(device, null, "\t", 1).toString()); } }
private static void dumpGLInfo(final GLDrawableFactoryImpl factory, final AbstractGraphicsDevice device) { final GLContext ctx = factory.getOrCreateSharedContext(device); if(null != ctx) { System.err.println("GLProfile.dumpGLInfo: "+ctx); ctx.makeCurrent(); try { System.err.println(JoglVersion.getGLInfo(ctx.getGL(), null)); } finally { ctx.release(); } } else { System.err.println("GLProfile.dumpGLInfo: shared context n/a"); System.err.println(device.getClass().getSimpleName()+"[type "+ device.getType()+", connection "+device.getConnection()+"]:"); System.err.println(GLProfile.glAvailabilityToString(device, null, "\t", 1).toString()); } }
/** * Since GLContext's {@link GLContext#makeCurrent()} and {@link GLContext#release()} * is recursive, a call to {@link GLContext#release()} may not natively release the context. * <p> * This methods continues calling {@link GLContext#release()} until the context has been natively released. * </p> * @param ctx */ public static final void forceNativeRelease(final GLContext ctx) { int releaseCount = 0; do { ctx.release(); releaseCount++; if (DEBUG) { System.err.println("GLDrawableHelper.forceNativeRelease() #"+releaseCount+" -- currentThread "+Thread.currentThread()+" -> "+GLContext.getCurrent()); } } while( MAX_RELEASE_ITER > releaseCount && ctx.isCurrent() ); if( ctx.isCurrent() ) { throw new GLException("Context still current after "+MAX_RELEASE_ITER+" releases: "+ctx); } }
/** * Since GLContext's {@link GLContext#makeCurrent()} and {@link GLContext#release()} * is recursive, a call to {@link GLContext#release()} may not natively release the context. * <p> * This methods continues calling {@link GLContext#release()} until the context has been natively released. * </p> * @param ctx */ public static final void forceNativeRelease(final GLContext ctx) { int releaseCount = 0; do { ctx.release(); releaseCount++; if (DEBUG) { System.err.println("GLDrawableHelper.forceNativeRelease() #"+releaseCount+" -- currentThread "+Thread.currentThread()+" -> "+GLContext.getCurrent()); } } while( MAX_RELEASE_ITER > releaseCount && ctx.isCurrent() ); if( ctx.isCurrent() ) { throw new GLException("Context still current after "+MAX_RELEASE_ITER+" releases: "+ctx); } }
public void project() { GL gl = getCurrentGL(); scene.getGraph().project(gl, glu, cam); getCurrentContext().release(); }
pbuffer.getContext().release();
public Coord3d projectMouse(int x, int y) { GL gl = getCurrentGL(); Coord3d p = cam.screenToModel(gl, glu, new Coord3d(x, y, 0)); getCurrentContext().release(); return p; }
/** * Disposes this texture name. When practical, this method should be called * explicitly. Otherwise, it will be called when this object is finalized * during garbage collection. */ public synchronized void dispose() { if (_context!=null) { GLContext current = GLContext.getCurrent(); if (_context==current || _context.makeCurrent()==GLContext.CONTEXT_CURRENT) { try { //System.out.println("dispose: deleting name="+_name); int[] names = {_name}; glDeleteTextures(1,names,0); } finally { if (_context!=current) { _context.release(); current.makeCurrent(); } } } _context = null; _name = 0; } }
/** * Disposes this display list. When practical, this method should be called * explicitly. Otherwise, it will be called when this object is finalized * during garbage collection. */ public synchronized void dispose() { if (_context!=null) { GLContext current = GLContext.getCurrent(); if (_context==current || _context.makeCurrent()==GLContext.CONTEXT_CURRENT) { try { glDeleteLists(_list,_range); } finally { if (_context!=current) { _context.release(); current.makeCurrent(); } } } _context = null; _list = 0; _range = 0; } }
@Override void destroyContext(Drawable drawable, Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.destroyContext()"); JoglDrawable joglDrawable = (JoglDrawable)drawable; GLContext context = context(ctx); if (GLContext.getCurrent() == context) { context.release(); } context.destroy(); // assuming this is the right point at which to make this call joglDrawable.getGLDrawable().setRealized(false); joglDrawable.destroyNativeWindow(); }
private void doQuery() { if (alreadyRan) return; GLContext context = glDrawable.createContext(null); int res = context.makeCurrent(); if (res != GLContext.CONTEXT_NOT_CURRENT) { try { chooser.init(context); } finally { context.release(); } } context.destroy(); alreadyRan = true; glDrawable.setRealized(false); nativeWindow.destroy(); } }
sharedContext.release(); } else { sharedDrawable.unlockSurface();
sharedContext.release();
} finally { try { ourContext.release(); if(ctxSwitch) { curContext.makeCurrent();
final GLContext lastContext = GLContext.getCurrent(); if (lastContext != null) { lastContext.release();
glContext.release(); glContext.destroy(); glDrawable.setRealized(false);
public final synchronized void initGL(final GL gl) { final GLContext glCtx = gl.getContext(); final boolean glCtxCurrent = glCtx.isCurrent(); final GLProfile glp = gl.getGLProfile(); final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); final AbstractGraphicsDevice device = glCtx.getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); dummyDrawable = factory.createDummyDrawable(device, true, glCtx.getGLDrawable().getChosenGLCapabilities(), null); // own device! dummyDrawable.setRealized(true); sharedGLCtx = dummyDrawable.createContext(glCtx); makeCurrent(sharedGLCtx); if( glCtxCurrent ) { makeCurrent(glCtx); } else { sharedGLCtx.release(); } } public final synchronized void doPause(final boolean waitUntilDone) {
gl.glFlush(); if(!owner.isInFrame()) owner.getPbuffer().getContext().release();