@Override protected void initContextFirstTime(){ offscreenDrawable.getContext().makeCurrent(); try { super.initContextFirstTime(); } finally { offscreenDrawable.getContext().release(); } }
int res = glContext.makeCurrent(); if (res == GLContext.CONTEXT_NOT_CURRENT)
private void makeCurrent(final GLContext ctx) { if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) { throw new GLException("Couldn't make ctx current: "+ctx); } }
@Override boolean useCtx(Context ctx, Drawable drawable) { if (VERBOSE) System.err.println("JoglPipeline.useCtx()"); GLContext context = context(ctx); int res = context.makeCurrent(); return (res != GLContext.CONTEXT_NOT_CURRENT); }
private void setupContext() { if(context == null) { context = GLContext.getCurrent(); } if(context!=null) { GLContext.getCurrent().makeCurrent(); } }
/** * 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; } }
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()); } }
if(pbuffer.getContext().makeCurrent()==GLContext.CONTEXT_NOT_CURRENT)
public GL getCurrentGL() { getCurrentContext().makeCurrent(); return getCanvasAsGLAutoDrawable().getGL().getGL2(); }
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(); } }
context.makeCurrent(); currentContext.makeCurrent();
if ( factory.hasRendererQuirk(device, null, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { throw new GLException("Could not make Shared Context current: "+device);
if ( factory.hasRendererQuirk(device, null, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { throw new GLException("Could not make Shared Context current: "+device);
public void release() { final int minLevel = settings.pyramidLevelMin; final int maxLevel = settings.pyramidLevelMax; if (templateCL != null && targetCL != null && transformedCL != null && residualCL != null && maskCL != null) { for (int i = minLevel; i <= maxLevel; i++) { if (i > minLevel) templateCL[i].release(); if (i > minLevel) targetCL [i].release(); transformedCL[i].release(); residualCL [i].release(); maskCL [i].release(); } templateCL = targetCL = transformedCL = residualCL = maskCL = null; } // NVIDIA drivers crash if we don't delete those before terminating context.getGLContext().makeCurrent(); GL2 gl = context.getGL2(); if (maskfb != null) { gl.glDeleteFramebuffers(maxLevel+1, maskfb, 0); maskfb = null; } if (maskrb != null) { gl.glDeleteRenderbuffers(maxLevel+1, maskrb, 0); maskrb = null; } } @Override protected void finalize() throws Throwable {
sr.context.release(); if (lastContext != null) { lastContext.makeCurrent();
glContext.makeCurrent();
if(pbuffer.getContext().makeCurrent()==GLContext.CONTEXT_NOT_CURRENT)
private void updateVideo(int frametype) if(owner.isInFrame() || (owner.getPbuffer().getContext().makeCurrent()==GLContext.CONTEXT_NOT_CURRENT))