aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-28 18:37:55 +0200
committerSven Gothel <[email protected]>2012-06-28 18:37:55 +0200
commitbd92af2b6b0ae2d1b1f22c64dcb0ffd0e94fae84 (patch)
treeaf392e26356f160e0a5d8237d6358e40892969dc /src/jogl/classes/jogamp/opengl
parent914b522af26b6d779dc931bf4303be3c7e898eff (diff)
GLDrawable* cleanup: Add @Override, remove trailing whitespace, ..
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLPbufferImpl.java69
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java129
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java85
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java15
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java129
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java105
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java13
18 files changed, 401 insertions, 224 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
index 9a4cf1f94..9b3def434 100644
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,20 +29,17 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl;
-import com.jogamp.common.util.locks.LockFactory;
-import com.jogamp.common.util.locks.RecursiveLock;
-
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GL;
@@ -57,6 +54,9 @@ import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLRunnable;
+import com.jogamp.common.util.locks.LockFactory;
+import com.jogamp.common.util.locks.RecursiveLock;
+
/** Platform-independent class exposing pbuffer functionality to
applications. This class is not exposed in the public API as it
would probably add no value; however it implements the GLDrawable
@@ -87,21 +87,25 @@ public class GLPbufferImpl implements GLPbuffer {
context = (GLContextImpl) pbufferDrawable.createContext(parentContext);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return pbufferDrawable.createContext(shareWith);
}
+ @Override
public void setRealized(boolean realized) {
}
+ @Override
public boolean isRealized() {
return true;
}
+ @Override
public void destroy() {
if(pbufferDrawable.isRealized()) {
final AbstractGraphicsDevice adevice = pbufferDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
-
+
if (null != context && context.isCreated()) {
try {
drawableHelper.disposeGL(GLPbufferImpl.this, pbufferDrawable, context, null);
@@ -113,7 +117,7 @@ public class GLPbufferImpl implements GLPbuffer {
}
pbufferDrawable.destroy();
pbufferDrawable = null;
-
+
if(null != adevice) {
adevice.close();
}
@@ -125,26 +129,32 @@ public class GLPbufferImpl implements GLPbuffer {
throw new GLException("Not yet implemented");
}
+ @Override
public NativeSurface getNativeSurface() {
return pbufferDrawable.getNativeSurface();
}
+ @Override
public long getHandle() {
return pbufferDrawable.getHandle();
}
+ @Override
public GLDrawableFactory getFactory() {
return pbufferDrawable.getFactory();
}
+ @Override
public int getWidth() {
return pbufferDrawable.getWidth();
}
+ @Override
public int getHeight() {
return pbufferDrawable.getHeight();
}
+ @Override
public void display() {
invokeGL(displayAction);
}
@@ -153,37 +163,45 @@ public class GLPbufferImpl implements GLPbuffer {
display();
}
+ @Override
public void addGLEventListener(GLEventListener listener) {
drawableHelper.addGLEventListener(listener);
}
+ @Override
public void addGLEventListener(int index, GLEventListener listener) {
drawableHelper.addGLEventListener(index, listener);
}
+ @Override
public void removeGLEventListener(GLEventListener listener) {
drawableHelper.removeGLEventListener(listener);
}
+ @Override
public void setAnimator(GLAnimatorControl animatorControl) {
drawableHelper.setAnimator(animatorControl);
}
+ @Override
public GLAnimatorControl getAnimator() {
return drawableHelper.getAnimator();
}
+ @Override
public void invoke(boolean wait, GLRunnable glRunnable) {
drawableHelper.invoke(this, wait, glRunnable);
}
+ @Override
public void setContext(GLContext ctx) {
context=(GLContextImpl)ctx;
if(null != context) {
context.setContextCreationFlags(additionalCtxCreationFlags);
- }
+ }
}
+ @Override
public GLContext getContext() {
return context;
}
@@ -192,49 +210,59 @@ public class GLPbufferImpl implements GLPbuffer {
return pbufferDrawable;
}
+ @Override
public GL getGL() {
return getContext().getGL();
}
+ @Override
public GL setGL(GL gl) {
return getContext().setGL(gl);
}
+ @Override
public void setAutoSwapBufferMode(boolean onOrOff) {
drawableHelper.setAutoSwapBufferMode(onOrOff);
}
+ @Override
public boolean getAutoSwapBufferMode() {
return drawableHelper.getAutoSwapBufferMode();
}
+ @Override
public void swapBuffers() {
invokeGL(swapBuffersAction);
}
+ @Override
public void setContextCreationFlags(int flags) {
additionalCtxCreationFlags = flags;
if(null != context) {
context.setContextCreationFlags(additionalCtxCreationFlags);
- }
+ }
}
-
+
+ @Override
public int getContextCreationFlags() {
- return additionalCtxCreationFlags;
+ return additionalCtxCreationFlags;
}
-
+
+ @Override
public void bindTexture() {
// Doesn't make much sense to try to do this on the event dispatch
// thread given that it has to be called while the context is current
context.bindPbufferToTexture();
}
+ @Override
public void releaseTexture() {
// Doesn't make much sense to try to do this on the event dispatch
// thread given that it has to be called while the context is current
context.releasePbufferFromTexture();
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (pbufferDrawable == null)
return null;
@@ -249,6 +277,7 @@ public class GLPbufferImpl implements GLPbuffer {
return pbufferDrawable.getRequestedGLCapabilities();
}
+ @Override
public GLProfile getGLProfile() {
if (pbufferDrawable == null)
return null;
@@ -267,6 +296,7 @@ public class GLPbufferImpl implements GLPbuffer {
recurLock.unlock();
}
+ @Override
public int getFloatingPointMode() {
if (floatMode == 0) {
throw new GLException("Pbuffer not initialized, or floating-point support not requested");
@@ -284,14 +314,16 @@ public class GLPbufferImpl implements GLPbuffer {
class InitAction implements Runnable {
+ @Override
public void run() {
floatMode = context.getFloatingPointMode();
drawableHelper.init(GLPbufferImpl.this);
}
}
private InitAction initAction = new InitAction();
-
+
class DisplayAction implements Runnable {
+ @Override
public void run() {
drawableHelper.display(GLPbufferImpl.this);
}
@@ -299,6 +331,7 @@ public class GLPbufferImpl implements GLPbuffer {
private DisplayAction displayAction = new DisplayAction();
class SwapBuffersAction implements Runnable {
+ @Override
public void run() {
pbufferDrawable.swapBuffers();
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 4b77bfa87..e4f6f0ef8 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,36 +29,50 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.egl;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.DefaultGraphicsScreen;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.NativeWindowFactory;
+import javax.media.nativewindow.ProxySurface;
+import javax.media.nativewindow.VisualIDHolder;
+import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GLProfile.ShutdownType;
+import jogamp.opengl.GLDrawableFactoryImpl;
+import jogamp.opengl.GLDrawableImpl;
+import jogamp.opengl.GLDynamicLookupHelper;
+
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.*;
+import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.nativewindow.WrappedSurface;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
-import jogamp.opengl.*;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null;
private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null;
private static boolean isANGLE = false;
-
+
private static final boolean isANGLE(GLDynamicLookupHelper dl) {
if(Platform.OSType.WINDOWS == Platform.OS_TYPE) {
final boolean r = 0 != dl.dynamicLookupFunction("eglQuerySurfacePointerANGLE") ||
@@ -69,10 +83,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
}
-
+
public EGLDrawableFactory() {
super();
-
+
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
EGLGraphicsConfigurationFactory.registerFactory();
@@ -85,15 +99,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
-
- // FIXME: Probably need to move EGL from a static model
- // to a dynamic one, where there can be 2 instances
+
+ // FIXME: Probably need to move EGL from a static model
+ // to a dynamic one, where there can be 2 instances
// for each ES profile with their own ProcAddressTable.
synchronized(EGLDrawableFactory.class) {
/**
* Currently AMD's EGL impl. crashes at eglGetDisplay(EGL_DEFAULT_DISPLAY)
- *
+ *
// Check Desktop ES2 Availability first (AMD, ..)
if(null==eglES2DynamicLookupHelper) {
GLDynamicLookupHelper tmp=null;
@@ -103,19 +117,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if(DEBUG) {
gle.printStackTrace();
}
- }
+ }
if(null!=tmp && tmp.isLibComplete()) {
eglES2DynamicLookupHelper = tmp;
EGL.resetProcAddressTable(eglES2DynamicLookupHelper);
if (GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory: Desktop ES2 - OK");
- }
+ }
} else if (GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory: Desktop ES2 - NOPE");
- }
+ }
} */
final boolean hasDesktopES2 = null != eglES2DynamicLookupHelper;
-
+
if(!hasDesktopES2 && null==eglES1DynamicLookupHelper) {
GLDynamicLookupHelper tmp=null;
try {
@@ -124,7 +138,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if(DEBUG) {
gle.printStackTrace();
}
- }
+ }
if(null!=tmp && tmp.isLibComplete()) {
eglES1DynamicLookupHelper = tmp;
EGL.resetProcAddressTable(eglES1DynamicLookupHelper);
@@ -132,10 +146,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
isANGLE |= isANGLEES1;
if (GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK, isANGLE: "+isANGLEES1);
- }
+ }
} else if (GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE");
- }
+ }
}
if(!hasDesktopES2 && null==eglES2DynamicLookupHelper) {
GLDynamicLookupHelper tmp=null;
@@ -145,7 +159,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if(DEBUG) {
gle.printStackTrace();
}
- }
+ }
if(null!=tmp && tmp.isLibComplete()) {
eglES2DynamicLookupHelper = tmp;
EGL.resetProcAddressTable(eglES2DynamicLookupHelper);
@@ -153,14 +167,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
isANGLE |= isANGLEES2;
if (GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK, isANGLE: "+isANGLEES2);
- }
+ }
} else if (GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory: EGL ES2 - NOPE");
- }
+ }
}
}
}
+ @Override
protected final void destroy(ShutdownType shutdownType) {
if(null != sharedMap) {
Collection<SharedResource> srl = sharedMap.values();
@@ -205,7 +220,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
private final boolean wasES1ContextCreated;
private final boolean wasES2ContextCreated;
- SharedResource(EGLGraphicsDevice dev, boolean wasContextES1Created, boolean wasContextES2Created
+ SharedResource(EGLGraphicsDevice dev, boolean wasContextES1Created, boolean wasContextES2Created
/*EGLDrawable draw, EGLContext ctxES1, EGLContext ctxES2 */) {
this.device = dev;
// this.drawable = draw;
@@ -222,10 +237,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean wasES2ContextAvailable() { return wasES2ContextCreated; }
}
+ @Override
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
}
+ @Override
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
// via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types.
return null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper;
@@ -239,7 +256,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
caps.setDoubleBuffered(false);
caps.setOnscreen(false);
caps.setPBuffer(true);
- final EGLDrawable drawable = (EGLDrawable) createGLDrawable( createOffscreenSurfaceImpl(sharedDevice, caps, caps, null, 64, 64) );
+ final EGLDrawable drawable = (EGLDrawable) createGLDrawable( createOffscreenSurfaceImpl(sharedDevice, caps, caps, null, 64, 64) );
if(null!=drawable) {
final EGLContext context = (EGLContext) drawable.createContext(null);
if (null != context) {
@@ -251,7 +268,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if (DEBUG) {
System.err.println("EGLDrawableFactory.createShared: INFO: makeCurrent failed");
gle.printStackTrace();
- }
+ }
} finally {
context.destroy();
}
@@ -260,7 +277,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
return madeCurrent;
} */
-
+
/* package */ SharedResource getOrCreateEGLSharedResource(AbstractGraphicsDevice adevice) {
if(null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper) {
return null;
@@ -268,7 +285,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
String connection = adevice.getConnection();
SharedResource sr;
synchronized(sharedMap) {
- sr = (SharedResource) sharedMap.get(connection);
+ sr = sharedMap.get(connection);
}
if(null==sr) {
long eglDisplay = EGLDisplayUtil.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
@@ -280,7 +297,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if (!EGLDisplayUtil.eglInitialize(eglDisplay, null, null)) {
throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
}
- final EGLGraphicsDevice sharedDevice = new EGLGraphicsDevice(eglDisplay, connection, adevice.getUnitID());
+ final EGLGraphicsDevice sharedDevice = new EGLGraphicsDevice(eglDisplay, connection, adevice.getUnitID());
// final boolean madeCurrentES1 = isEGLContextAvailable(sharedDevice, GLProfile.GLES1);
// final boolean madeCurrentES2 = isEGLContextAvailable(sharedDevice, GLProfile.GLES2);
final boolean madeCurrentES1 = true; // FIXME
@@ -293,15 +310,17 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("EGLDrawableFactory.createShared: device: " + sharedDevice);
System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1);
System.err.println("EGLDrawableFactory.createShared: context ES2: " + madeCurrentES2);
- }
+ }
}
return sr;
}
+ @Override
protected final Thread getSharedResourceThread() {
return null;
}
-
+
+ @Override
protected final boolean createSharedResource(AbstractGraphicsDevice device) {
try {
SharedResource sr = getOrCreateEGLSharedResource(device);
@@ -314,13 +333,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
gle.printStackTrace();
}
}
- return false;
+ return false;
}
-
+
+ @Override
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
return null; // n/a for EGL .. since we don't keep the resources
}
-
+
+ @Override
protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
SharedResource sr = getOrCreateEGLSharedResource(device);
if(null!=sr) {
@@ -332,7 +353,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public boolean isANGLE() {
return isANGLE;
}
-
+
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) {
if (2==esProfile) {
return eglES2DynamicLookupHelper;
@@ -343,6 +365,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
if(null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper) {
return new ArrayList<GLCapabilitiesImmutable>(); // null
@@ -350,6 +373,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return EGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device);
}
+ @Override
protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -357,6 +381,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return new EGLOnscreenDrawable(this, target);
}
+ @Override
protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -370,17 +395,20 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return new EGLPbufferDrawable(this, target);
}
+ @Override
public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
return true;
}
+ @Override
protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
WrappedSurface ns = new WrappedSurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(device, capsChosen, capsRequested, chooser));
ns.surfaceSizeChanged(width, height);
return ns;
}
- protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice adevice, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
+ @Override
+ protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice adevice, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
// FIXME device/windowHandle -> screen ?!
EGLGraphicsDevice device = (EGLGraphicsDevice) adevice;
DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
@@ -388,24 +416,29 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
WrappedSurface ns = new WrappedSurface(cfg, windowHandle);
return ns;
}
-
+
+ @Override
protected GLContext createExternalGLContextImpl() {
AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL);
return new EGLExternalContext(absScreen);
}
+ @Override
public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return false;
}
+ @Override
protected GLDrawable createExternalGLDrawableImpl() {
throw new GLException("Not yet implemented");
}
+ @Override
public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
+ @Override
public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException {
throw new GLException("Unimplemented on this platform");
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 71c0d5539..6bdabbf59 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -74,7 +74,7 @@ import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
private static DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper = null;
-
+
public MacOSXCGLDrawableFactory() {
super();
@@ -90,30 +90,31 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
if(null!=tmp && tmp.isLibComplete()) {
macOSXCGLDynamicLookupHelper = tmp;
- /** FIXME ??
+ /** FIXME ??
CGL.getCGLProcAddressTable().reset(macOSXCGLDynamicLookupHelper);
*/
}
}
}
-
+
defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
-
+
if(null!=macOSXCGLDynamicLookupHelper) {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
MacOSXCGLGraphicsConfigurationFactory.registerFactory();
if(GLProfile.isAWTAvailable()) {
try {
- ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
- "registerFactory", null, null, getClass().getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
+ "registerFactory", null, null, getClass().getClassLoader());
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
-
+
sharedMap = new HashMap<String, SharedResource>();
- }
+ }
}
+ @Override
protected final void destroy(ShutdownType shutdownType) {
if(null != sharedMap) {
sharedMap.clear();
@@ -122,13 +123,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
defaultDevice = null;
/**
* Pulling away the native library may cause havoc ..
- *
+ *
if(ShutdownType.COMPLETE == shutdownType && null != macOSXCGLDynamicLookupHelper) {
macOSXCGLDynamicLookupHelper.destroy();
macOSXCGLDynamicLookupHelper = null;
} */
}
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return macOSXCGLDynamicLookupHelper;
}
@@ -145,7 +147,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
boolean hasRECTTextures;
boolean hasAppleFloatPixels;
- SharedResource(MacOSXGraphicsDevice device, boolean wasContextCreated,
+ SharedResource(MacOSXGraphicsDevice device, boolean wasContextCreated,
boolean hasNPOTTextures, boolean hasRECTTextures, boolean hasAppletFloatPixels
/* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */) {
// drawable = draw;
@@ -163,10 +165,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean isAppleFloatPixelsAvailable() { return hasAppleFloatPixels; }
}
+ @Override
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
}
+ @Override
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
if(null!=macOSXCGLDynamicLookupHelper && device instanceof MacOSXGraphicsDevice) {
return true;
@@ -191,7 +195,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
devicesTried.remove(connection);
}
}
-
+
/* package */ SharedResource getOrCreateOSXSharedResource(AbstractGraphicsDevice adevice) {
final String connection = adevice.getConnection();
SharedResource sr;
@@ -209,14 +213,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
if (null == glp) {
throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice);
- }
+ }
final GLCapabilities caps = new GLCapabilities(glp);
caps.setRedBits(5); caps.setGreenBits(5); caps.setBlueBits(5); caps.setAlphaBits(0);
caps.setDepthBits(5);
caps.setDoubleBuffered(false);
caps.setOnscreen(false);
caps.setPBuffer(true);
- final MacOSXCGLDrawable drawable = (MacOSXCGLDrawable) createGLDrawable( createOffscreenSurfaceImpl(sharedDevice, caps, caps, null, 64, 64) );
+ final MacOSXCGLDrawable drawable = (MacOSXCGLDrawable) createGLDrawable( createOffscreenSurfaceImpl(sharedDevice, caps, caps, null, 64, 64) );
if(null!=drawable) {
drawable.setRealized(true);
final GLContext context = drawable.createContext(null);
@@ -242,7 +246,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
if (DEBUG) {
System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy catched exception:");
gle.printStackTrace();
- }
+ }
}
}
}
@@ -258,15 +262,17 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("MacOSXCGLDrawableFactory.createShared: device: " + sharedDevice);
System.err.println("MacOSXCGLDrawableFactory.createShared: context: madeCurrent " + madeCurrent + ", NPOT "+hasNPOTTextures+
", RECT "+hasRECTTextures+", FloatPixels "+hasAppleFloatPixels);
- }
+ }
}
return sr;
}
-
+
+ @Override
protected final Thread getSharedResourceThread() {
return null;
}
-
+
+ @Override
protected final boolean createSharedResource(AbstractGraphicsDevice device) {
try {
SharedResource sr = getOrCreateOSXSharedResource(device);
@@ -279,14 +285,16 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
gle.printStackTrace();
}
}
- return false;
+ return false;
}
-
+
+ @Override
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
// FIXME: not implemented .. needs a dummy OSX surface
return null;
}
+ @Override
protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
SharedResource sr = getOrCreateOSXSharedResource(device);
if(null!=sr) {
@@ -295,10 +303,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
+ @Override
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device);
}
+ @Override
protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -306,6 +316,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return new MacOSXOnscreenCGLDrawable(this, target);
}
+ @Override
protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
AbstractGraphicsConfiguration config = target.getGraphicsConfiguration();
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
@@ -315,10 +326,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return new MacOSXPbufferCGLDrawable(this, target);
}
+ @Override
public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
return true;
}
+ @Override
protected NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device,GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX);
WrappedSurface ns = new WrappedSurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true));
@@ -326,34 +339,40 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return ns;
}
+ @Override
protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice device, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
- AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
+ AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
WrappedSurface ns = new WrappedSurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true), windowHandle);
- return ns;
- }
-
+ return ns;
+ }
+
+ @Override
protected GLContext createExternalGLContextImpl() {
return MacOSXExternalCGLContext.create(this);
}
+ @Override
public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return false;
}
+ @Override
protected GLDrawable createExternalGLDrawableImpl() {
// FIXME
throw new GLException("Not yet implemented");
}
+ @Override
public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
+ @Override
public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException {
throw new GLException("not supported in non AWT enviroment");
}
-
+
//------------------------------------------------------
// Gamma-related functionality
//
@@ -362,10 +381,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
/** Returns the length of the computed gamma ramp for this OS and
hardware. Returns 0 if gamma changes are not supported. */
+ @Override
protected int getGammaRampLength() {
return GAMMA_RAMP_LENGTH;
}
+ @Override
protected boolean setGammaRamp(float[] ramp) {
return CGL.setGammaRamp(ramp.length,
ramp, 0,
@@ -373,10 +394,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
ramp, 0);
}
+ @Override
protected Buffer getGammaRamp() {
return null;
}
+ @Override
protected void resetGammaRamp(Buffer originalGammaRamp) {
CGL.resetGammaRamp();
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
index f81cd725e..4f9005504 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -51,6 +51,7 @@ public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable {
super(factory, target);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new MacOSXOffscreenCGLContext(this, shareWith);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index 07d30a488..b1e283ebc 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -45,7 +45,7 @@ import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
-
+
protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) {
super(factory, component, false);
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
index 02da1e667..dc3b58cfa 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -40,9 +40,9 @@
package jogamp.opengl.windows.wgl;
-import com.jogamp.common.nio.PointerBuffer;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.SurfaceChangeable;
+import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
@@ -50,7 +50,8 @@ import javax.media.opengl.GLException;
import jogamp.nativewindow.windows.BITMAPINFO;
import jogamp.nativewindow.windows.BITMAPINFOHEADER;
import jogamp.nativewindow.windows.GDI;
-import javax.media.opengl.GLCapabilitiesImmutable;
+
+import com.jogamp.common.nio.PointerBuffer;
public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
private long origbitmap;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java
index 2c1bcc265..244c1553f 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -40,18 +40,17 @@
package jogamp.opengl.windows.wgl;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-import javax.media.nativewindow.AbstractGraphicsScreen;
import jogamp.nativewindow.windows.GDI;
-import jogamp.nativewindow.windows.GDIUtil;
-
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLException;
import jogamp.nativewindow.windows.GDISurface;
+import jogamp.nativewindow.windows.GDIUtil;
public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
private long hwnd;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
index 90a3ebba9..8f22aa60e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -49,10 +49,10 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-import com.jogamp.nativewindow.WrappedSurface;
-
import jogamp.nativewindow.windows.GDI;
+import com.jogamp.nativewindow.WrappedSurface;
+
public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
private WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeSurface component) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
index 2fe4d618e..ddbb29d51 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
@@ -40,8 +40,9 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeSurface component) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
index 3f3f3ccc4..762bea3b1 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -44,17 +44,16 @@ import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.SurfaceChangeable;
import javax.media.opengl.GL;
+import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
-// import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import jogamp.nativewindow.windows.GDI;
import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory.SharedResource;
-
-import javax.media.opengl.GLCapabilitiesImmutable;
+// import javax.media.opengl.GLPbuffer;
public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
private WGLExt cachedWGLExt; // cached WGLExt instance from parent GLCanvas,
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 494bb307e..054e1fe90 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -46,33 +46,25 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.DefaultGraphicsScreen;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.ProxySurface;
import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLCapabilitiesChooser;
+import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLProfile.ShutdownType;
-import com.jogamp.common.JogampRuntimeException;
-import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.ReflectionUtil;
-import com.jogamp.common.util.VersionNumber;
-import com.jogamp.nativewindow.WrappedSurface;
-import com.jogamp.nativewindow.windows.WindowsGraphicsDevice;
-
import jogamp.nativewindow.windows.GDI;
-import jogamp.nativewindow.windows.GDIUtil;
import jogamp.nativewindow.windows.GDISurface;
+import jogamp.nativewindow.windows.GDIUtil;
import jogamp.nativewindow.windows.RegisteredClassFactory;
import jogamp.opengl.DesktopGLDynamicLookupHelper;
import jogamp.opengl.GLDrawableFactoryImpl;
@@ -80,9 +72,17 @@ import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.SharedResourceRunner;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.common.util.VersionNumber;
+import com.jogamp.nativewindow.WrappedSurface;
+import com.jogamp.nativewindow.windows.WindowsGraphicsDevice;
+
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private static DesktopGLDynamicLookupHelper windowsWGLDynamicLookupHelper = null;
-
+
public WindowsWGLDrawableFactory() {
super();
@@ -95,29 +95,29 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
if(DEBUG) {
gle.printStackTrace();
}
- }
+ }
if(null!=tmp && tmp.isLibComplete()) {
windowsWGLDynamicLookupHelper = tmp;
WGL.getWGLProcAddressTable().reset(windowsWGLDynamicLookupHelper);
- }
+ }
}
}
-
+
defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
-
+
if(null!=windowsWGLDynamicLookupHelper) {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
WindowsWGLGraphicsConfigurationFactory.registerFactory();
if(GLProfile.isAWTAvailable()) {
try {
- ReflectionUtil.callStaticMethod("jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
- "registerFactory", null, null, getClass().getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
+ "registerFactory", null, null, getClass().getClassLoader());
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
-
+
sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
-
+
// Init shared resources off thread
// Will be released via ShutdownHook
sharedResourceRunner = new SharedResourceRunner(new SharedResourceImplementation());
@@ -125,6 +125,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
protected final void destroy(ShutdownType shutdownType) {
if(null != sharedResourceRunner) {
sharedResourceRunner.stop();
@@ -137,15 +138,16 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
defaultDevice = null;
/**
* Pulling away the native library may cause havoc ..
- *
+ *
if(ShutdownType.COMPLETE == shutdownType && null != windowsWGLDynamicLookupHelper) {
windowsWGLDynamicLookupHelper.destroy();
windowsWGLDynamicLookupHelper = null;
} */
-
+
RegisteredClassFactory.shutdownSharedClasses();
}
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return windowsWGLDynamicLookupHelper;
}
@@ -158,6 +160,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private PointerBuffer procMask = PointerBuffer.allocateDirect(1);
private PointerBuffer sysMask = PointerBuffer.allocateDirect(1);
+ @Override
protected void enterThreadCriticalZone() {
synchronized (sysMask) {
if( 0 == processAffinityChanges) {
@@ -174,6 +177,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
protected void leaveThreadCriticalZone() {
synchronized (sysMask) {
if( 0 != processAffinityChanges) {
@@ -194,8 +198,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
* http://msdn.microsoft.com/en-us/library/ms724832%28v=vs.85%29.aspx
* Windows XP 5.1
*/
- static final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
-
+ static final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
+
static class SharedResource implements SharedResourceRunner.Resource {
private WindowsGraphicsDevice device;
private AbstractGraphicsScreen screen;
@@ -225,7 +229,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
isVendorNVIDIA = vendor.startsWith("NVIDIA") ;
isVendorATI = vendor.startsWith("ATI") ;
}
-
+
if ( isVendorATI() ) {
final VersionNumber winVersion = Platform.getOSVersionNumber();
final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0;
@@ -233,61 +237,70 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion());
}
needsCurrenContext4ARBPFDQueries = isWinXPOrLess;
- } else {
+ } else {
if(DEBUG) {
System.err.println("needsCurrenContext4ARBPFDQueries: false");
}
needsCurrenContext4ARBPFDQueries = false;
- }
+ }
}
-
+
+ @Override
final public AbstractGraphicsDevice getDevice() { return device; }
+ @Override
final public AbstractGraphicsScreen getScreen() { return screen; }
+ @Override
final public WindowsWGLDrawable getDrawable() { return drawable; }
+ @Override
final public WindowsWGLContext getContext() { return context; }
final boolean hasARBPixelFormat() { return hasARBPixelFormat; }
final boolean hasARBMultisample() { return hasARBMultisample; }
final boolean hasARBPBuffer() { return hasARBPBuffer; }
final boolean hasReadDrawable() { return hasARBReadDrawable; }
-
+
final String vendor() { return vendor; }
final boolean isVendorATI() { return isVendorATI; }
final boolean isVendorNVIDIA() { return isVendorNVIDIA; }
-
+
/**
* Solves bug #480
- *
+ *
* TODO: Validate if bug is actually relates to the 'old' ATI Windows driver for old GPU's like X300 etc
* and unrelated to the actual Windows version !
- *
- * @return true if GL_VENDOR is ATI _and_ platform is Windows version XP or less!
+ *
+ * @return true if GL_VENDOR is ATI _and_ platform is Windows version XP or less!
*/
- final boolean needsCurrentContext4ARBPFDQueries() { return needsCurrenContext4ARBPFDQueries; }
+ final boolean needsCurrentContext4ARBPFDQueries() { return needsCurrenContext4ARBPFDQueries; }
}
class SharedResourceImplementation implements SharedResourceRunner.Implementation {
+ @Override
public void clear() {
synchronized(sharedMap) {
sharedMap.clear();
}
}
+ @Override
public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) {
synchronized(sharedMap) {
return sharedMap.put(connection, resource);
}
}
+ @Override
public SharedResourceRunner.Resource mapGet(String connection) {
synchronized(sharedMap) {
return sharedMap.get(connection);
}
}
+ @Override
public Collection<SharedResourceRunner.Resource> mapValues() {
synchronized(sharedMap) {
return sharedMap.values();
}
}
+ @Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT);
sharedDevice.lock();
@@ -333,7 +346,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("readDrawable: " + hasARBReadDrawableAvailable);
System.err.println("vendor: " + vendor);
}
- return new SharedResource(sharedDevice, absScreen, sharedDrawable, sharedContext,
+ return new SharedResource(sharedDevice, absScreen, sharedDrawable, sharedContext,
hasARBPixelFormat, hasARBMultisample,
hasARBPBuffer, hasARBReadDrawableAvailable, vendor);
} catch (Throwable t) {
@@ -343,6 +356,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
public void releaseSharedResource(SharedResourceRunner.Resource shared) {
SharedResource sr = (SharedResource) shared;
if (DEBUG) {
@@ -374,10 +388,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
}
+ @Override
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
if(null!=windowsWGLDynamicLookupHelper && device instanceof WindowsGraphicsDevice) {
return true;
@@ -392,10 +408,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final static String WGL_ARB_make_current_read = "WGL_ARB_make_current_read";
final static String wglMakeContextCurrent = "wglMakeContextCurrent";
+ @Override
protected final Thread getSharedResourceThread() {
return sharedResourceRunner.start();
}
-
+
+ @Override
protected final boolean createSharedResource(AbstractGraphicsDevice device) {
try {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
@@ -410,7 +428,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
return false;
}
-
+
+ @Override
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
@@ -419,6 +438,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
+ @Override
protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
@@ -439,10 +459,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return (SharedResource) sharedResourceRunner.getOrCreateShared(device);
}
+ @Override
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return WindowsWGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device);
}
+ @Override
protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -450,6 +472,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return new WindowsOnscreenWGLDrawable(this, target);
}
+ @Override
protected final GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -501,6 +524,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return -1; // undefined
}
+ @Override
public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared((null!=device)?device:defaultDevice);
if(null!=sr) {
@@ -509,6 +533,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
+ @Override
protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice device, GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, int width, int height) {
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
WrappedSurface ns = new WrappedSurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
@@ -516,24 +541,28 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
ns.surfaceSizeChanged(width, height);
return ns;
}
-
+
+ @Override
protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice adevice, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
// FIXME device/windowHandle -> screen ?!
WindowsGraphicsDevice device = (WindowsGraphicsDevice) adevice;
AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
- WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen);
+ WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen);
GDISurface ns = new GDISurface(cfg, windowHandle);
return ns;
}
-
+
+ @Override
protected final GLContext createExternalGLContextImpl() {
return WindowsExternalWGLContext.create(this, null);
}
+ @Override
public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return true;
}
+ @Override
protected final GLDrawable createExternalGLDrawableImpl() {
return WindowsExternalWGLDrawable.create(this, null);
}
@@ -553,10 +582,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return detail;
}
+ @Override
public final boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
+ @Override
public final GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException {
throw new GLException("Unimplemented on this platform");
@@ -568,10 +599,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private static final int GAMMA_RAMP_LENGTH = 256;
+ @Override
protected final int getGammaRampLength() {
return GAMMA_RAMP_LENGTH;
}
+ @Override
protected final boolean setGammaRamp(float[] ramp) {
short[] rampData = new short[3 * GAMMA_RAMP_LENGTH];
for (int i = 0; i < GAMMA_RAMP_LENGTH; i++) {
@@ -587,6 +620,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return res;
}
+ @Override
protected final Buffer getGammaRamp() {
ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]);
long screenDC = GDI.GetDC(0);
@@ -598,6 +632,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
return rampData;
}
+ @Override
protected final void resetGammaRamp(Buffer originalGammaRamp) {
if (originalGammaRamp == null) {
// getGammaRamp failed earlier
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java
index 73f9871ea..65f65a2ec 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java
@@ -28,14 +28,17 @@
package jogamp.opengl.x11.glx;
-import javax.media.opengl.*;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLProfile;
+
+import jogamp.nativewindow.x11.X11Lib;
import com.jogamp.nativewindow.WrappedSurface;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
import com.jogamp.nativewindow.x11.X11GraphicsScreen;
-import jogamp.nativewindow.x11.*;
-
public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
private static final int f_dim = 64;
private long dummyWindow = 0;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
index 83d15a0a2..3fabe7a13 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
@@ -45,7 +45,6 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-
import com.jogamp.nativewindow.WrappedSurface;
import com.jogamp.nativewindow.x11.X11GraphicsScreen;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
index 2c53ce6f3..e9912ce9d 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
@@ -40,10 +40,11 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.opengl.GLDrawableFactory;
-import jogamp.opengl.*;
+import jogamp.opengl.GLDrawableImpl;
+import jogamp.opengl.GLDynamicLookupHelper;
public abstract class X11GLXDrawable extends GLDrawableImpl {
protected X11GLXDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 092d3439e..77af0d698 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,7 +29,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -72,7 +72,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice;
import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
-
+
public static final VersionNumber versionOneZero = new VersionNumber(1, 0, 0);
public static final VersionNumber versionOneOne = new VersionNumber(1, 1, 0);
public static final VersionNumber versionOneTwo = new VersionNumber(1, 2, 0);
@@ -80,7 +80,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
public static final VersionNumber versionOneFour = new VersionNumber(1, 4, 0);
private static DesktopGLDynamicLookupHelper x11GLXDynamicLookupHelper = null;
-
+
public X11GLXDrawableFactory() {
super();
@@ -93,30 +93,31 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
if(DEBUG) {
gle.printStackTrace();
}
- }
+ }
if(null!=tmp && tmp.isLibComplete()) {
x11GLXDynamicLookupHelper = tmp;
GLX.getGLXProcAddressTable().reset(x11GLXDynamicLookupHelper);
}
}
}
-
+
defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
-
+
if(null!=x11GLXDynamicLookupHelper) {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
X11GLXGraphicsConfigurationFactory.registerFactory();
-
+
sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
-
+
// Init shared resources off thread
// Will be released via ShutdownHook
sharedResourceRunner = new SharedResourceRunner(new SharedResourceImplementation());
sharedResourceRunner.start();
- }
+ }
}
+ @Override
protected final void destroy(ShutdownType shutdownType) {
if(null != sharedResourceRunner) {
sharedResourceRunner.stop();
@@ -129,7 +130,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
defaultDevice = null;
/**
* Pulling away the native library may cause havoc ..
- *
+ *
if(ShutdownType.COMPLETE == shutdownType && null != x11GLXDynamicLookupHelper) {
x11GLXDynamicLookupHelper.destroy();
x11GLXDynamicLookupHelper = null;
@@ -140,13 +141,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
X11Util.shutdown( false, DEBUG );
}
+ @Override
public final GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return x11GLXDynamicLookupHelper;
}
private X11GraphicsDevice defaultDevice;
private SharedResourceRunner sharedResourceRunner;
- private HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap;
+ private HashMap<String /* connection */, SharedResourceRunner.Resource> sharedMap;
static class SharedResource implements SharedResourceRunner.Resource {
X11GraphicsDevice device;
@@ -169,16 +171,20 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
drawable = draw;
context = ctx;
glXServerVersion = glXServerVer;
- glXServerVersionOneOneCapable = glXServerVersion.compareTo(versionOneOne) >= 0 ;
- glXServerVersionOneThreeCapable = glXServerVersion.compareTo(versionOneThree) >= 0 ;
+ glXServerVersionOneOneCapable = glXServerVersion.compareTo(versionOneOne) >= 0 ;
+ glXServerVersionOneThreeCapable = glXServerVersion.compareTo(versionOneThree) >= 0 ;
glXServerVendorName = glXServerVendor;
isGLXServerVendorATI = GLXUtil.isVendorATI(glXServerVendorName);
isGLXServerVendorNVIDIA = GLXUtil.isVendorNVIDIA(glXServerVendorName);
glXMultisampleAvailable = glXServerMultisampleAvail;
}
+ @Override
final public AbstractGraphicsDevice getDevice() { return device; }
+ @Override
final public AbstractGraphicsScreen getScreen() { return screen; }
+ @Override
final public GLDrawableImpl getDrawable() { return drawable; }
+ @Override
final public GLContextImpl getContext() { return context; }
final String getGLXVendorName() { return glXServerVendorName; }
@@ -191,42 +197,47 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
class SharedResourceImplementation implements SharedResourceRunner.Implementation {
+ @Override
public void clear() {
synchronized(sharedMap) {
sharedMap.clear();
}
}
+ @Override
public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) {
synchronized(sharedMap) {
return sharedMap.put(connection, resource);
}
}
+ @Override
public SharedResourceRunner.Resource mapGet(String connection) {
synchronized(sharedMap) {
return sharedMap.get(connection);
}
}
+ @Override
public Collection<SharedResourceRunner.Resource> mapValues() {
synchronized(sharedMap) {
return sharedMap.values();
}
}
+ @Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
- X11GraphicsDevice sharedDevice =
- new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
+ X11GraphicsDevice sharedDevice =
+ new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
true); // own non-shared display connection, no locking
- // new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
+ // new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT,
// NativeWindowFactory.getNullToolkitLock(), true); // own non-shared display connection, no locking
sharedDevice.lock();
try {
if(!GLXUtil.isGLXAvailableOnServer(sharedDevice)) {
throw new GLException("GLX not available on device/server: "+sharedDevice);
}
- GLXUtil.initGLXClientDataSingleton(sharedDevice);
+ GLXUtil.initGLXClientDataSingleton(sharedDevice);
final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR);
final VersionNumber glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice.getHandle());
- final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS));
+ final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS));
if(X11Util.ATI_HAS_XCLOSEDISPLAY_BUG && GLXUtil.isVendorATI(glXServerVendorName)) {
X11Util.setMarkAllDisplaysUnclosable(true);
X11Util.markDisplayUncloseable(sharedDevice.getHandle());
@@ -263,8 +274,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("GLX Client Version: " + GLXUtil.getClientVersionNumber());
System.err.println("GLX Client Multisample: " + GLXUtil.isClientMultisampleAvailable());
}
- return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext,
- glXServerVersion, glXServerVendorName,
+ return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext,
+ glXServerVersion, glXServerVendorName,
glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable());
} catch (Throwable t) {
throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t);
@@ -273,6 +284,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
public void releaseSharedResource(SharedResourceRunner.Resource shared) {
SharedResource sr = (SharedResource) shared;
if (DEBUG) {
@@ -308,10 +320,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
}
+ @Override
public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
if(null != x11GLXDynamicLookupHelper && device instanceof X11GraphicsDevice) {
return true;
@@ -319,10 +333,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
+ @Override
protected final Thread getSharedResourceThread() {
return sharedResourceRunner.start();
}
-
+
+ @Override
protected final boolean createSharedResource(AbstractGraphicsDevice device) {
try {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
@@ -337,7 +353,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
return false;
}
-
+
+ @Override
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
@@ -346,6 +363,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
+ @Override
protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
@@ -366,10 +384,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return (SharedResource) sharedResourceRunner.getOrCreateShared(device);
}
+ @Override
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return X11GLXGraphicsConfigurationFactory.getAvailableCapabilities(this, device);
}
+ @Override
protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -377,6 +397,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return new X11OnscreenGLXDrawable(this, target);
}
+ @Override
protected final GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -412,7 +433,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
public final boolean isGLXMultisampleAvailable(AbstractGraphicsDevice device) {
- if(null != device) {
+ if(null != device) {
SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
return sr.isGLXMultisampleAvailable();
@@ -422,7 +443,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
public final VersionNumber getGLXVersionNumber(AbstractGraphicsDevice device) {
- if(null != device) {
+ if(null != device) {
SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
return sr.getGLXVersion();
@@ -433,9 +454,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
return null;
}
-
+
public final boolean isGLXVersionGreaterEqualOneOne(AbstractGraphicsDevice device) {
- if(null != device) {
+ if(null != device) {
SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
return sr.isGLXVersionGreaterEqualOneOne();
@@ -447,9 +468,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
return false;
}
-
+
public final boolean isGLXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) {
- if(null != device) {
+ if(null != device) {
SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
return sr.isGLXVersionGreaterEqualOneThree();
@@ -462,6 +483,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
+ @Override
public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
if(null == device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice);
@@ -472,6 +494,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return isGLXVersionGreaterEqualOneThree(device);
}
+ @Override
protected final NativeSurface createOffscreenSurfaceImpl(AbstractGraphicsDevice deviceReq,
GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
@@ -488,8 +511,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
// create screen/device pair - Null X11 locking, due to private non-shared Display handle
final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(sharedDevice.getConnection()), AbstractGraphicsDevice.DEFAULT_UNIT, NativeWindowFactory.getNullToolkitLock(), true);
- final X11GraphicsScreen screen = new X11GraphicsScreen(device, sharedScreen.getIndex());
-
+ final X11GraphicsScreen screen = new X11GraphicsScreen(device, sharedScreen.getIndex());
+
WrappedSurface ns = new WrappedSurface(
X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen) );
if(ns != null) {
@@ -498,6 +521,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return ns;
}
+ @Override
protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice adevice, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
// FIXME device/windowHandle -> screen ?!
X11GraphicsDevice device = (X11GraphicsDevice) adevice;
@@ -506,23 +530,28 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
WrappedSurface ns = new WrappedSurface(cfg, windowHandle);
return ns;
}
-
+
+ @Override
protected final GLContext createExternalGLContextImpl() {
return X11ExternalGLXContext.create(this, null);
}
+ @Override
public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return canCreateGLPbuffer(device);
}
+ @Override
protected final GLDrawable createExternalGLDrawableImpl() {
return X11ExternalGLXDrawable.create(this, null);
}
+ @Override
public final boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
+ @Override
public final GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException {
throw new GLException("Unimplemented on this platform");
@@ -534,6 +563,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
private boolean gotGammaRampLength;
private int gammaRampLength;
+ @Override
protected final synchronized int getGammaRampLength() {
if (gotGammaRampLength) {
return gammaRampLength;
@@ -556,6 +586,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return gammaRampLength;
}
+ @Override
protected final boolean setGammaRamp(float[] ramp) {
long display = getOrCreateSharedDpy(defaultDevice);
if(0 == display) {
@@ -577,6 +608,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return res;
}
+ @Override
protected final Buffer getGammaRamp() {
long display = getOrCreateSharedDpy(defaultDevice);
if(0 == display) {
@@ -607,6 +639,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return rampData;
}
+ @Override
protected final void resetGammaRamp(Buffer originalGammaRamp) {
if (originalGammaRamp == null) {
return; // getGammaRamp failed originally
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
index 6b7a65159..734716677 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
@@ -40,8 +40,10 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
public class X11OnscreenGLXDrawable extends X11GLXDrawable {
/** GLXWindow can't be made current on AWT with NVidia driver, hence disabled for now */
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
index cf801b0db..29003ef52 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
@@ -40,8 +40,15 @@
package jogamp.opengl.x11.glx;
-import javax.media.opengl.*;
-import javax.media.nativewindow.*;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.SurfaceChangeable;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLPbuffer;
public class X11PbufferGLXDrawable extends X11GLXDrawable {
protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
index d884df39d..18aa780b6 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
@@ -40,9 +40,16 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import jogamp.nativewindow.x11.*;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.NativeSurface;
+import javax.media.nativewindow.SurfaceChangeable;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLException;
+
+import jogamp.nativewindow.x11.X11Lib;
+import jogamp.nativewindow.x11.XVisualInfo;
public class X11PixmapGLXDrawable extends X11GLXDrawable {
private long pixmap;