protected static String toHexString(final int hex) { return GLContext.toHexString(hex); } protected static String toHexString(final long hex) {
protected static String toHexString(final long hex) { return GLContext.toHexString(hex); }
/** * 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); }
/** * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ protected static String getDeviceVersionAvailableKey(final AbstractGraphicsDevice device, final int major, final int profile) { final String r = device.getUniqueID() + "-" + toHexString(composeBits(major, profile, 0)); return r.intern(); }
private final boolean wglMakeContextCurrent(final long hDrawDC, final long hReadDC, final long ctx) { boolean ok = false; if(wglGLReadDrawableAvailable) { // needs initilized WGL ProcAddress table ok = getWGLExt().wglMakeContextCurrent(hDrawDC, hReadDC, ctx); } else if ( hDrawDC == hReadDC ) { ok = WGL.wglMakeCurrent(hDrawDC, ctx); } else { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } final int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS; if(DEBUG && !ok) { final Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+ GLContext.toHexString(hDrawDC) + ", read " + GLContext.toHexString(hReadDC) + ", ctx " + GLContext.toHexString(ctx) + ", werr " + werr); t.printStackTrace(); } if(!ok && 0==hDrawDC && 0==hReadDC) { // Some GPU's falsely fails with a zero error code (success), // in case this is a release context request we tolerate this return werr == GDI.ERROR_SUCCESS ; } return ok; }
public final StringBuilder append(final StringBuilder sb) { sb.append("Version ").append(getGLVersion()).append(" [GL ").append(getGLVersionNumber()).append(", vendor ").append(getGLVendorVersionNumber()); sb.append("], options 0x"); sb.append(Integer.toHexString(ctxOptions)); sb.append(", this "); sb.append(toHexString(hashCode())); sb.append(", handle "); sb.append(toHexString(contextHandle)); sb.append(", isShared "+isShared()+", "); sb.append(getGL()); sb.append(",\n\t quirks: "); if(null != glRendererQuirks) { glRendererQuirks.toString(sb); } else { sb.append("n/a"); } if(getGLDrawable()!=getGLReadDrawable()) { sb.append(",\n\tRead Drawable : "); sb.append(getGLReadDrawable()); sb.append(",\n\tWrite Drawable: "); sb.append(getGLDrawable()); } else { sb.append(",\n\tDrawable: "); sb.append(getGLDrawable()); } return sb; }