/** * @param isInit true if called for class initialization, otherwise false (re-init or destruction). */ protected void resetStates(final boolean isInit) { if (DEBUG) { System.err.println(getThreadName() + ": GLContext.resetStates(isInit "+isInit+")"); // Thread.dumpStack(); } ctxVersion = VersionNumberString.zeroVersion; ctxVendorVersion = VersionNumberString.zeroVersion; ctxOptions=0; ctxVersionString=null; ctxGLSLVersion = VersionNumber.zeroVersion; attachedObjects.clear(); contextHandle=0; currentSwapInterval = -1; glRendererQuirks = null; drawableRetargeted = false; }
protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { final String devKey = device.getUniqueID(); if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) { throw new InternalError("Already set: "+devKey); } if (DEBUG) { System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey); System.err.println(GLContext.dumpAvailableGLVersions(null).toString()); } } }
/** * Sets the thread-local variable returned by {@link #getCurrent} * and has no other side-effects. For use by third parties adding * new GLContext implementations; not for use by end users. */ protected static void setCurrent(final GLContext cur) { if( TRACE_SWITCH ) { if(null == cur) { System.err.println(getThreadName()+": GLContext.ContextSwitch: - setCurrent() - NULL"); } else { System.err.println(getThreadName()+": GLContext.ContextSwitch: - setCurrent() - obj " + toHexString(cur.hashCode()) + ", ctx " + toHexString(cur.getHandle())); } } currentContext.set(cur); }
/** * @throws GLException if this GLContext is not current on this thread */ public final void validateCurrent() throws GLException { if(getCurrent() != this) { throw new GLException(getThreadName()+": This context is not current. Current context: "+getCurrent()+", this context "+this); } }
/** * Returns the GL object bound to this thread current context. * If no context is current, throw an GLException * * @return the current context's GL object on this thread * @throws GLException if no context is current */ public static GL getCurrentGL() throws GLException { final GLContext glc = getCurrent(); if(null==glc) { throw new GLException(getThreadName()+": No OpenGL context current on this thread"); } return glc.getGL(); }