/** * Fixes the requested {@link GLCapabilitiesImmutable} according to on- and offscreen usage. * <p> * No modification will be made for onscreen usage, for offscreen usage see * {@link #fixOffscreenGLCapabilities(GLCapabilitiesImmutable, GLDrawableFactory, AbstractGraphicsDevice)}. * </p> * @param capsRequested the requested {@link GLCapabilitiesImmutable} * @param factory the {@link GLDrawableFactory} used to validate the requested capabilities and later used to create the drawable. * @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}. * @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance. */ public static GLCapabilitiesImmutable fixGLCapabilities(final GLCapabilitiesImmutable capsRequested, final GLDrawableFactory factory, final AbstractGraphicsDevice device) { if( !capsRequested.isOnscreen() ) { return fixOffscreenGLCapabilities(capsRequested, factory, device); } return capsRequested; }
public static GLCapabilitiesImmutable fixOffscreenBitOnly(final GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); caps2.setOnscreen(false); return caps2; } return capsRequested; }
/** * @see #getExclusiveWinAttributeBits(boolean, boolean, boolean, boolean) */ public static final int getExclusiveWinAttributeBits(final GLCapabilitiesImmutable caps) { return getExclusiveWinAttributeBits(caps.isOnscreen(), caps.isFBO(), caps.isPBuffer(), caps.isBitmap()); }
requestedCaps.getAccumGreenBits() > 0 || requestedCaps.getAccumBlueBits() > 0; if( ( chosenCapsA.isOnscreen() && !chosenCapsB.isOnscreen() || !chosenCapsA.isOnscreen() && chosenCapsB.isOnscreen() ) && // switching between on- and offscreen
@Override protected boolean setSwapIntervalImpl(final int interval) { if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; }
if( caps.isOnscreen() ) { surfaceType = EGL.EGL_WINDOW_BIT; } else if( caps.isFBO() ) {
ivalues.put(idx, ( !caps.isOnscreen() && caps.isPBuffer() ) ? 1 : 0); break;
private final long getUpdateHandle() { if( 0 == updateHandle ) { lastWidth = -1; lastHeight = -1; if( isCreated() && drawable.getChosenGLCapabilities().isOnscreen() && isNSContext() ) { final boolean incompleteView; final NativeSurface surface = drawable.getNativeSurface(); if( surface instanceof ProxySurface ) { incompleteView = ((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE ); } else { incompleteView = false; } if(!incompleteView) { updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); if(0 == updateHandle) { throw new InternalError("XXX2"); } } } } return updateHandle; }
public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(final GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() || !capsRequested.isPBuffer() || capsRequested.isFBO() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); caps2.setOnscreen(false); caps2.setFBO(false); caps2.setPBuffer(true); caps2.setBitmap(false); return caps2; } return capsRequested; }
return drawable; if( drawable.getChosenGLCapabilities().isOnscreen() ) { throw new NativeWindowException("Drawable is not offscreen: "+drawable);
public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(final GLCapabilitiesImmutable capsRequested) { if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) { // fix caps .. final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); caps2.setBitmap (false); caps2.setPBuffer (false); caps2.setFBO (false); caps2.setOnscreen(true); return caps2; } return capsRequested; }
@Override protected void drawableUpdatedNotify() throws GLException { if( drawable.getChosenGLCapabilities().isOnscreen() ) { final long _updateHandle = getUpdateHandle(); final int w = drawable.getSurfaceWidth(); final int h = drawable.getSurfaceHeight(); final boolean updateContext = ( 0!=_updateHandle && CGL.updateContextNeedsUpdate(_updateHandle) ) || w != lastWidth || h != lastHeight; if(updateContext) { lastWidth = w; lastHeight = h; if (contextHandle == 0) { throw new GLException("Context not created"); } CGL.updateContext(contextHandle); } } }
if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) { final RecursiveLock _lock = lock; _lock.lock();
private void reshapeImpl(final int width, final int height) { final int scaledWidth = width * hasPixelScale[0]; final int scaledHeight = height * hasPixelScale[1]; if(DEBUG) { final NativeSurface ns = getNativeSurface(); final long nsH = null != ns ? ns.getSurfaceHandle() : 0; System.err.println(getThreadName()+": GLCanvas.reshape.0 "+this.getName()+" resize"+(printActive?"WithinPrint":"")+ " [ this "+getWidth()+"x"+getHeight()+", pixelScale "+getPixelScaleStr()+ "] -> "+(printActive?"[skipped] ":"") + width+"x"+height+" * "+getPixelScaleStr()+" -> "+scaledWidth+"x"+scaledHeight+ " - surfaceHandle 0x"+Long.toHexString(nsH)); // Thread.dumpStack(); } if( validateGLDrawable() && !printActive ) { final GLDrawableImpl _drawable = drawable; if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) { final RecursiveLock _lock = lock; _lock.lock(); try { final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, scaledWidth, scaledHeight); if(_drawable != _drawableNew) { // write back drawable = _drawableNew; } } finally { _lock.unlock(); } } sendReshape = true; // async if display() doesn't get called below, but avoiding deadlock } }
result = createOffscreenDrawableImpl(target); } else if(chosenCaps.isOnscreen()) {
final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer();
System.err.println("GLAutoDrawableBase.sizeChanged: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(surfaceHandle)); if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) { final RecursiveLock _lock = getUpstreamLock(); _lock.lock();
fixedCaps.setPBuffer( fixedCaps.isPBuffer() && !chosenCaps.isOnscreen() ); fixedCaps.setBitmap( false ); // n/a in our OSX impl. fixedCaps.setOnscreen( !fixedCaps.isPBuffer() );
final boolean useBitmap = !useFBO && !usePbuffer && bitmapAvailable && ( auto || capsRequested.isBitmap() ) ; if( capsRequested.isOnscreen() || useFBO != capsRequested.isFBO() || usePbuffer != capsRequested.isPBuffer() ||
if( caps.isOnscreen() ) { pfdFlags |= GDI.PFD_DRAW_TO_WINDOW; } else if( caps.isFBO() ) {