private void makeCurrent(final GLContext ctx) { if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) { throw new GLException("Couldn't make ctx current: "+ctx); } }
protected void drawOffscreen( DrawContext dc ) { context.makeCurrent( ); try { drawOffscreen( dc.getGLContext( ) ); } finally { dc.getGLContext( ).makeCurrent( ); } }
private void giveBackContext() { _parentContext.makeCurrent(); ContextManager.switchContext(_oldContext.getContextKey()); }
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"); } }
final boolean releaseContext; if( GLContext.CONTEXT_NOT_CURRENT == res ) { res = context.makeCurrent(); releaseContext = !_isExclusiveThread; ctxClaimed = true; final int res2 = lastContext.makeCurrent(); if (null != lastInitAction && res2 == GLContext.CONTEXT_CURRENT_NEW) { lastInitAction.run();
@Override public void onPaint(CefBrowser browser, boolean popup, Rectangle[] dirtyRects, ByteBuffer buffer, int width, int height) { canvas_.getContext().makeCurrent(); renderer_.onPaint(canvas_.getGL().getGL2(), popup, dirtyRects, buffer, width, height); canvas_.getContext().release(); SwingUtilities.invokeLater(new Runnable() { public void run() { canvas_.display(); } }); }
final boolean releaseContext; if( GLContext.CONTEXT_NOT_CURRENT == res ) { res = context.makeCurrent(); releaseContext = !_isExclusiveThread; } else { final int res2 = lastContext.makeCurrent(); if (null != lastInitAction && res2 == GLContext.CONTEXT_CURRENT_NEW) { lastInitAction.run();
do { try { value = _context.makeCurrent(); } catch (final GLException gle) { gle.printStackTrace();
res = context.makeCurrent(); if (GLContext.CONTEXT_NOT_CURRENT != res) { if(GLContext.CONTEXT_CURRENT_NEW == res) { final int res2 = lastContext.makeCurrent(); if (null != lastInitAction && res2 == GLContext.CONTEXT_CURRENT_NEW) { lastInitAction.run();
public void init(GLAutoDrawable drawable) { vtkAbstractJoglComponent.this.isWindowCreated = true; // Make sure the JOGL Context is current GLContext ctx = drawable.getContext(); if (!ctx.isCurrent()) { ctx.makeCurrent(); } // Init VTK OpenGL RenderWindow vtkAbstractJoglComponent.this.glRenderWindow.SetMapped(1); vtkAbstractJoglComponent.this.glRenderWindow.SetPosition(0, 0); vtkAbstractJoglComponent.this.setSize(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); vtkAbstractJoglComponent.this.glRenderWindow.OpenGLInit(); }
protected void drawOffscreen( GLContext glContext ) { OGLStackHandler stack = new OGLStackHandler( ); GL2 gl = glContext.getGL( ).getGL2( ); stack.pushAttrib( gl, GL2.GL_ALL_ATTRIB_BITS ); stack.pushClientAttrib( gl, ( int ) GL2.GL_ALL_CLIENT_ATTRIB_BITS ); stack.pushTexture( gl ); stack.pushModelview( gl ); stack.pushProjection( gl ); GLContext c = offscreenCanvas.getGLContext( ); if ( c != null ) { c.makeCurrent( ); try { offscreenCanvas.paint( ); } catch ( Exception e ) { logWarning( logger, "Trouble drawing to offscreen buffer", e ); } finally { glContext.makeCurrent( ); stack.pop( gl ); } } }
j2dContext.makeCurrent(); final GL gl = j2dContext.getGL(); if ((getGLInteger(gl, GL.GL_RED_BITS) < reqOffscreenCaps.getRedBits()) || j2dContext.makeCurrent();
context.makeCurrent(); currentContext.makeCurrent();
if ( factory.hasRendererQuirk(device, 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, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { throw new GLException("Could not make Shared Context current: "+device);
ourContext.makeCurrent(); ourContext.release(); if(ctxSwitch) { curContext.makeCurrent();
private void activate() { if (_active == 0) { _oldContext = ContextManager.getCurrentContext(); _context.makeCurrent(); ContextManager.switchContext(_context); ContextManager.getCurrentContext().clearEnforcedStates(); ContextManager.getCurrentContext().enforceStates(_enforcedStates); if (_bgColorDirty) { final GL gl = GLContext.getCurrentGL(); gl.glClearColor(_backgroundColor.getRed(), _backgroundColor.getGreen(), _backgroundColor.getBlue(), _backgroundColor.getAlpha()); _bgColorDirty = false; } } _active++; }
sr.context.release(); if (lastContext != null) { lastContext.makeCurrent();
_context = _offscreenDrawable.getContext(); _context.makeCurrent();
c.makeCurrent( ); try glContext.makeCurrent( ); stack.pop( gl );