summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLAutoDrawable.java66
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawable.java30
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPbuffer.java15
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java16
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java175
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java190
-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
24 files changed, 716 insertions, 401 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index c676535c8..94e4bad66 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.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.
*/
@@ -54,7 +54,7 @@ import jogamp.opengl.Debug;
based rendering mechanism as well by end users directly.<P>
The implementation shall initialize itself as soon as possible,
- ie if the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible/realized.
+ ie if the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible/realized.
The following protocol shall be satisfied:
<ul>
<li> Create the {@link GLDrawable} with the requested {@link GLCapabilities}</li>
@@ -66,15 +66,15 @@ import jogamp.opengl.Debug;
registered {@link GLEventListener}s. This shall be done after the {@link GLEventListener#init init(..)} calls.</li>
</ul><P>
- Another implementation detail is the drawable reconfiguration. One use case is where a window is being
- dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation
+ Another implementation detail is the drawable reconfiguration. One use case is where a window is being
+ dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation
shall be able to detect such cases in conjunction with the associated {@link javax.media.nativewindow.NativeSurface NativeSurface}.<br>
For example, AWT's {@link java.awt.Canvas} 's {@link java.awt.Canvas#getGraphicsConfiguration getGraphicsConfiguration()}
- is capable to determine a display device change. This is demonstrated within {@link javax.media.opengl.awt.GLCanvas}'s
- and NEWT's <code>AWTCanvas</code> {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()}
- specialization. Another demonstration is NEWT's {@link javax.media.nativewindow.NativeWindow NativeWindow}
+ is capable to determine a display device change. This is demonstrated within {@link javax.media.opengl.awt.GLCanvas}'s
+ and NEWT's <code>AWTCanvas</code> {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()}
+ specialization. Another demonstration is NEWT's {@link javax.media.nativewindow.NativeWindow NativeWindow}
implementation on the Windows platform, which utilizes the native platform's <i>MonitorFromWindow(HWND)</i> function.<br>
- All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has
+ All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has
to be choosen again. The following protocol shall be satisfied.
<ul>
<li> Controlled disposal:</li>
@@ -95,21 +95,21 @@ import jogamp.opengl.Debug;
registered {@link GLEventListener}s. This shall be done after the {@link GLEventListener#init init(..)} calls.</li>
</ul>
</ul>
- Note: Current graphics driver keep the surface configuration for a given window, even if the window is moved to
+ Note: Current graphics driver keep the surface configuration for a given window, even if the window is moved to
a monitor with a different pixel configuration, ie 32bpp to 16bpp. However, it is best to not assume such behavior
and make your application comply with the above protocol.<P>
- However, to not introduce to much breakage with older applications and because of the situation
- mentioned above, the <code>boolean</code> system property <code>jogl.screenchange.action</code> will control the
+ However, to not introduce to much breakage with older applications and because of the situation
+ mentioned above, the <code>boolean</code> system property <code>jogl.screenchange.action</code> will control the
screen change action as follows:<br>
<PRE>
-Djogl.screenchange.action=false Disable the drawable reconfiguration (the default)
-Djogl.screenchange.action=true Enable the drawable reconfiguration
- </PRE>
+ </PRE>
*/
public interface GLAutoDrawable extends GLDrawable {
- /** Flag reflecting wheather the drawable reconfiguration will be issued in
+ /** Flag reflecting wheather the drawable reconfiguration will be issued in
* case a screen device change occured, e.g. in a multihead environment,
* where you drag the window to another monitor. */
public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true);
@@ -130,10 +130,10 @@ public interface GLAutoDrawable extends GLDrawable {
The listeners are notified of events in the order of the queue. */
public void addGLEventListener(GLEventListener listener);
- /**
+ /**
* Adds a {@link GLEventListener} at the given index of this drawable queue.
* The listeners are notified of events in the order of the queue.
- * @param index Position where the listener will be inserted.
+ * @param index Position where the listener will be inserted.
* Should be within (0 <= index && index <= size()).
* An index value of -1 is interpreted as the end of the list, size().
* @param listener The GLEventListener object to be inserted
@@ -168,7 +168,7 @@ public interface GLAutoDrawable extends GLDrawable {
* @see #display()
* @see #invoke(boolean, GLRunnable)
* @see javax.media.opengl.GLAnimatorControl
- */
+ */
public abstract void setAnimator(GLAnimatorControl animatorControl) throws GLException;
/**
@@ -179,12 +179,12 @@ public interface GLAutoDrawable extends GLDrawable {
*/
public GLAnimatorControl getAnimator();
- /**
+ /**
* <p>
* Enqueues a one-shot {@link GLRunnable},
* which will be executed within the next {@link #display()} call
- * after all registered {@link GLEventListener}s
- * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
+ * after all registered {@link GLEventListener}s
+ * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
* methods has been called.
* </p>
* <p>
@@ -201,7 +201,7 @@ public interface GLAutoDrawable extends GLDrawable {
* @see #setAnimator(GLAnimatorControl)
* @see #display()
* @see GLRunnable
- */
+ */
public void invoke(boolean wait, GLRunnable glRunnable);
/** Destroys all resources associated with this GLAutoDrawable,
@@ -214,7 +214,7 @@ public interface GLAutoDrawable extends GLDrawable {
routine may be called manually. */
public void destroy();
- /**
+ /**
* <p>
* Causes OpenGL rendering to be performed for this GLAutoDrawable
* in the following order:
@@ -224,21 +224,21 @@ public interface GLAutoDrawable extends GLDrawable {
* <li> Executes all one-shot {@link javax.media.opengl.GLRunnable GLRunnable},
* enqueued via {@link #invoke(boolean, GLRunnable)}.</li>
* </ul></p>
- * <p>
+ * <p>
* May be called periodically by a running {@link javax.media.opengl.GLAnimatorControl} implementation,<br>
* which must register itself with {@link #setAnimator(javax.media.opengl.GLAnimatorControl)}.</p>
* <p>
* Called automatically by the window system toolkit upon receiving a repaint() request, <br>
* except an {@link javax.media.opengl.GLAnimatorControl} implementation {@link javax.media.opengl.GLAnimatorControl#isAnimating()}.</p>
- * <p>
+ * <p>
* This routine may also be called manually for better control over the
* rendering process. It is legal to call another GLAutoDrawable's
* display method from within the {@link GLEventListener#display
* display(..)} callback.</p>
* <p>
- * In case of a new generated OpenGL context,
+ * In case of a new generated OpenGL context,
* the implementation shall call {@link GLEventListener#init init(..)} for all
- * registered {@link GLEventListener}s <i>before</i> making the
+ * registered {@link GLEventListener}s <i>before</i> making the
* actual {@link GLEventListener#display display(..)} calls,
* in case this has not been done yet.</p>
*
@@ -260,12 +260,12 @@ public interface GLAutoDrawable extends GLDrawable {
/**
* @param flags Additional context creation flags.
- *
+ *
* @see GLContext#setContextCreationFlags(int)
* @see GLContext#enableGLDebugMessage(boolean)
*/
public void setContextCreationFlags(int flags);
-
+
/**
* @return Additional context creation flags
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index 2b86a04ba..10eea2efc 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.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.
*/
@@ -104,11 +104,11 @@ public interface GLDrawable {
*
* <P>
*
- * With an argument of <code>true</code>,
- * the minimum implementation shall call
+ * With an argument of <code>true</code>,
+ * the minimum implementation shall call
* {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successfull:
* <ul>
- * <li> Update the {@link GLCapabilities}, which are associated with
+ * <li> Update the {@link GLCapabilities}, which are associated with
* the attached {@link NativeSurface}'s {@link AbstractGraphicsConfiguration}.</li>
* <li> Release the lock with {@link NativeSurface#unlockSurface() NativeSurface's unlockSurface()}.</li>
* </ul><br>
@@ -146,7 +146,7 @@ public interface GLDrawable {
On some platforms, the pixel format is not directly associated
with the drawable; a best attempt is made to return a reasonable
value in this case. <br>
- This object shall be directly associated to the attached {@link NativeSurface}'s
+ This object shall be directly associated to the attached {@link NativeSurface}'s
{@link AbstractGraphicsConfiguration}, and if changes are necessary,
they should reflect those as well.
@return A copy of the queried object.
@@ -159,14 +159,14 @@ public interface GLDrawable {
public GLProfile getGLProfile();
/**
- * Returns the underlying native surface which surface handle
+ * Returns the underlying native surface which surface handle
* represents this OpenGL drawable's native resource.
- *
+ *
* @see #getHandle()
*/
public NativeSurface getNativeSurface();
- /**
+ /**
* This is the GL/Windowing drawable handle.<br>
* It is usually the {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle()},
* ie the native surface handle of the underlying windowing toolkit.<br>
@@ -175,7 +175,9 @@ public interface GLDrawable {
*/
public long getHandle();
+ /** Return the {@link GLDrawableFactory} being used to create this instance. */
public GLDrawableFactory getFactory();
+ @Override
public String toString();
}
diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
index 0250365b0..273a992cf 100644
--- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java
+++ b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,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.
*/
@@ -78,6 +78,7 @@ public interface GLPbuffer extends GLAutoDrawable {
pbuffer, the application must destroy any additional OpenGL
contexts which have been created for the pbuffer via {@link
#createContext}. */
+ @Override
public void destroy();
/** Indicates which vendor's extension is being used to support
diff --git a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
index d1e725b00..2698678af 100644
--- a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,18 +28,18 @@
* 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 javax.media.opengl.awt;
-import javax.media.opengl.*;
+import javax.media.opengl.GLAutoDrawable;
public interface AWTGLAutoDrawable extends GLAutoDrawable, ComponentEvents {
/** Requests a new width and height for this AWTGLAutoDrawable. */
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 0a75865e2..604dea057 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.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.
*/
@@ -139,22 +139,23 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private static final boolean DEBUG = Debug.debug("GLCanvas");
- private GLDrawableHelper drawableHelper = new GLDrawableHelper();
+ private final GLDrawableHelper drawableHelper = new GLDrawableHelper();
private AWTGraphicsConfiguration awtConfig;
private volatile GLDrawable drawable;
private GLContextImpl context;
private boolean sendReshape = false;
-
+
// copy of the cstr args, mainly for recreation
private GLCapabilitiesImmutable capsReqUser;
private GLCapabilitiesChooser chooser;
private GLContext shareWith;
- private int additionalCtxCreationFlags = 0;
+ private int additionalCtxCreationFlags = 0;
private GraphicsDevice device;
private boolean shallUseOffscreenLayer = false;
private AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
+ @Override
public void run() {
GLCanvas.this.destroy();
}
@@ -162,7 +163,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLCanvas component with a default set of OpenGL
capabilities, using the default OpenGL capabilities selection
- mechanism, on the default screen device.
+ mechanism, on the default screen device.
* @throws GLException if no default profile is available for the default desktop device.
*/
public GLCanvas() throws GLException {
@@ -171,7 +172,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLCanvas component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
- selection mechanism, on the default screen device.
+ selection mechanism, on the default screen device.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
* @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
*/
@@ -187,8 +188,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
* @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
*/
- public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith)
- throws GLException
+ public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith)
+ throws GLException
{
this(capsReqUser, null, shareWith, null);
}
@@ -207,14 +208,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
sharing</a>. The passed GraphicsDevice indicates the screen on
which to create the GLCanvas; the GLDrawableFactory uses the
default screen device of the local GraphicsEnvironment if null
- is passed for this argument.
+ is passed for this argument.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
public GLCanvas(GLCapabilitiesImmutable capsReqUser,
GLCapabilitiesChooser chooser,
GLContext shareWith,
- GraphicsDevice device)
- throws GLException
+ GraphicsDevice device)
+ throws GLException
{
/*
* Determination of the native window is made in 'super.addNotify()',
@@ -246,14 +247,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
this.device = device;
}
+ @Override
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
}
+ @Override
public final boolean getShallUseOffscreenLayer() {
- return shallUseOffscreenLayer;
+ return shallUseOffscreenLayer;
}
+ @Override
public final boolean isOffscreenLayerSurfaceEnabled() {
if(null != drawable) {
return ((JAWTWindow)drawable.getNativeSurface()).isOffscreenLayerSurfaceEnabled();
@@ -261,18 +265,18 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return false;
}
-
+
/**
* Overridden to choose a GraphicsConfiguration on a parent container's
* GraphicsDevice because both devices
*/
- @Override
+ @Override
public GraphicsConfiguration getGraphicsConfiguration() {
/*
* Workaround for problems with Xinerama and java.awt.Component.checkGD
* when adding to a container on a different graphics device than the
* one that this Canvas is associated with.
- *
+ *
* GC will be null unless:
* - A native peer has assigned it. This means we have a native
* peer, and are already comitted to a graphics configuration.
@@ -286,7 +290,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* chosen is only non-null on platforms where the GLDrawableFactory
* returns a non-null GraphicsConfiguration (in the GLCanvas
* constructor).
- *
+ *
* if gc is from this Canvas' native peer then it should equal chosen,
* otherwise it is from an ancestor component that this Canvas is being
* added to, and we go into this block.
@@ -298,21 +302,21 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* Check for compatibility with gc. If they differ by only the
* device then return a new GCconfig with the super-class' GDevice
* (and presumably the same visual ID in Xinerama).
- *
+ *
*/
if (!chosen.getDevice().getIDstring().equals(gc.getDevice().getIDstring())) {
/*
* Here we select a GraphicsConfiguration on the alternate
* device that is presumably identical to the chosen
* configuration, but on the other device.
- *
+ *
* Should really check to ensure that we select a configuration
* with the same X visual ID for Xinerama screens, otherwise the
* GLDrawable may have the wrong visual ID (I don't think this
* ever gets updated). May need to add a method to
* X11GLDrawableFactory to do this in a platform specific
* manner.
- *
+ *
* However, on platforms where we can actually get into this
* block, both devices should have the same visual list, and the
* same configuration should be selected here.
@@ -353,7 +357,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* return the GC that was selected in the constructor (and might
* cause an exception in Component.checkGD when adding to a
* container, but in this case that would be the desired behavior).
- *
+ *
*/
return chosen;
} else if (gc == null) {
@@ -372,14 +376,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
*/
return gc;
}
-
+
+ @Override
public GLContext createContext(GLContext shareWith) {
return (null != drawable) ? drawable.createContext(shareWith) : null;
}
+ @Override
public void setRealized(boolean realized) {
}
+ @Override
public boolean isRealized() {
return ( null != drawable ) ? drawable.isRealized() : false;
}
@@ -387,14 +394,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return ( null != drawable ) ? drawable.isRealized() : false;
}
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
+ @Override
public void display() {
if( !validateGLDrawable() ) {
if(DEBUG) {
@@ -402,7 +412,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
return; // not yet available ..
}
- Threading.invoke(true, displayOnEventDispatchThreadAction, getTreeLock());
+ Threading.invoke(true, displayOnEDTAction, getTreeLock());
awtWindowClosingProtocol.addClosingListenerOneShot();
}
@@ -425,14 +435,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
disposeRegenerate=regenerate;
if(context.isCreated()) {
- Threading.invoke(true, disposeOnEventDispatchThreadAction, getTreeLock());
+ Threading.invoke(true, disposeOnEDTAction, getTreeLock());
}
if(animatorPaused) {
animator.resume();
}
}
-
+
if(!regenerate) {
disposeAbstractGraphicsDevice();
}
@@ -443,8 +453,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
/**
- * Just an alias for removeNotify
+ * {@inheritDoc}
+ *
+ * <p>
+ * This impl. calls this class's {@link #removeNotify()} AWT override,
+ * where the actual implementation resides.
+ * </p>
*/
+ @Override
public void destroy() {
removeNotify();
}
@@ -546,7 +562,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
jawtWindow.unlockSurface();
}
}
-
+
private boolean validateGLDrawable() {
boolean realized = false;
if (!Beans.isDesignTime()) {
@@ -554,7 +570,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
realized = drawable.isRealized();
if ( !realized && 0 < drawable.getWidth() * drawable.getHeight() ) {
// make sure drawable realization happens on AWT EDT, due to AWTTree lock
- AWTEDTExecutor.singleton.invoke(true, setRealizedOnEventDispatchThreadAction);
+ AWTEDTExecutor.singleton.invoke(true, setRealizedOnEDTAction);
realized = true;
sendReshape=true; // ensure a reshape is being send ..
if(DEBUG) {
@@ -566,8 +582,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
return realized;
}
- private Runnable setRealizedOnEventDispatchThreadAction = new Runnable() {
- public void run() {
+ private Runnable setRealizedOnEDTAction = new Runnable() {
+ @Override
+ public void run() {
drawable.setRealized(true);
} };
@@ -626,7 +643,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** <B>Overrides:</B>
<DL><DD><CODE>update</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */
- /**
+ /**
* Overridden from Canvas to prevent the AWT's clearing of the
* canvas from interfering with the OpenGL rendering.
*/
@@ -634,31 +651,38 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void update(Graphics g) {
paint(g);
}
-
+
+ @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) {
@@ -666,10 +690,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
+ @Override
public GLContext getContext() {
return context;
}
+ @Override
public GL getGL() {
if (Beans.isDesignTime()) {
return null;
@@ -678,6 +704,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return (ctx == null) ? null : ctx.getGL();
}
+ @Override
public GL setGL(GL gl) {
GLContext ctx = getContext();
if (ctx != null) {
@@ -688,30 +715,37 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
+ @Override
public void setAutoSwapBufferMode(boolean onOrOff) {
drawableHelper.setAutoSwapBufferMode(onOrOff);
}
+ @Override
public boolean getAutoSwapBufferMode() {
return drawableHelper.getAutoSwapBufferMode();
}
+ @Override
public void swapBuffers() {
- Threading.invoke(true, swapBuffersOnEventDispatchThreadAction, getTreeLock());
+ Threading.invoke(true, swapBuffersOnEDTAction, getTreeLock());
}
+ @Override
public void setContextCreationFlags(int flags) {
additionalCtxCreationFlags = flags;
}
-
+
+ @Override
public int getContextCreationFlags() {
- return additionalCtxCreationFlags;
+ return additionalCtxCreationFlags;
}
-
+
+ @Override
public GLProfile getGLProfile() {
return capsReqUser.getGLProfile();
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (awtConfig == null) {
throw new GLException("No AWTGraphicsConfiguration: "+this);
@@ -728,14 +762,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return (GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities();
}
+ @Override
public NativeSurface getNativeSurface() {
return (null != drawable) ? drawable.getNativeSurface() : null;
}
+ @Override
public long getHandle() {
return (null != drawable) ? drawable.getHandle() : 0;
}
+ @Override
public GLDrawableFactory getFactory() {
return (null != drawable) ? drawable.getFactory() : null;
}
@@ -744,9 +781,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public String toString() {
final int dw = (null!=drawable) ? drawable.getWidth() : -1;
final int dh = (null!=drawable) ? drawable.getHeight() : -1;
-
+
return "AWT-GLCanvas[Realized "+isRealized()+
- ",\n\t"+((null!=drawable)?drawable.getClass().getName():"null-drawable")+
+ ",\n\t"+((null!=drawable)?drawable.getClass().getName():"null-drawable")+
",\n\tFactory "+getFactory()+
",\n\thandle 0x"+Long.toHexString(getHandle())+
",\n\tDrawable size "+dw+"x"+dh+
@@ -754,13 +791,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
",\n\tvisible "+isVisible()+
",\n\t"+awtConfig+"]";
}
-
+
//----------------------------------------------------------------------
// Internals only below this point
//
private boolean disposeRegenerate;
private final Runnable postDisposeAction = new Runnable() {
+ @Override
public void run() {
context=null;
if(null!=drawable) {
@@ -769,39 +807,41 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
drawable=null;
if(null!=jawtWindow) {
jawtWindow.destroy();
- }
+ }
}
-
+
if(disposeRegenerate) {
// Similar process as in addNotify()!
-
+
// Recreate GLDrawable/GLContext to reflect it's new graphics configuration
createDrawableAndContext();
-
+
if(DEBUG) {
System.err.println(getThreadName()+": GLCanvas.dispose(true): new drawable: "+drawable);
}
validateGLDrawable(); // immediate attempt to recreate the drawable
}
}
- };
+ };
- private final Runnable disposeOnEventDispatchThreadAction = new Runnable() {
+ private final Runnable disposeOnEDTAction = new Runnable() {
+ @Override
public void run() {
- drawableHelper.disposeGL(GLCanvas.this, drawable, context, postDisposeAction);
+ drawableHelper.disposeGL(GLCanvas.this, drawable, context, postDisposeAction);
}
};
private final Runnable disposeAbstractGraphicsDeviceAction = new Runnable() {
+ @Override
public void run() {
if(null != awtConfig) {
- final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration();
+ final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
final String adeviceMsg;
if(DEBUG) {
adeviceMsg = adevice.toString();
} else {
- adeviceMsg = null;
+ adeviceMsg = null;
}
boolean closed = adevice.close();
if(DEBUG) {
@@ -833,12 +873,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
private final Runnable initAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.init(GLCanvas.this);
}
};
-
+
private final Runnable displayAction = new Runnable() {
+ @Override
public void run() {
if (sendReshape) {
if(DEBUG) {
@@ -855,6 +897,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
};
private final Runnable swapBuffersAction = new Runnable() {
+ @Override
public void run() {
drawable.swapBuffers();
}
@@ -863,16 +906,18 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// Workaround for ATI driver bugs related to multithreading issues
// like simultaneous rendering via Animators to canvases that are
// being resized on the AWT event dispatch thread
- private final Runnable displayOnEventDispatchThreadAction = new Runnable() {
+ private final Runnable displayOnEDTAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.invokeGL(drawable, context, displayAction, initAction);
}
};
-
- private final Runnable swapBuffersOnEventDispatchThreadAction = new Runnable() {
+
+ private final Runnable swapBuffersOnEDTAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.invokeGL(drawable, context, swapBuffersAction, initAction);
- }
+ }
};
// Disables the AWT's erasing of this Canvas's background on Windows
@@ -886,6 +931,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if (!disableBackgroundEraseInitialized) {
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
Class<?> clazz = getToolkit().getClass();
@@ -946,7 +992,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return null;
}
- final AbstractGraphicsScreen aScreen = null != device ?
+ final AbstractGraphicsScreen aScreen = null != device ?
AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT):
AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = null;
@@ -960,6 +1006,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
try {
final ArrayList<AWTGraphicsConfiguration> bucket = new ArrayList<AWTGraphicsConfiguration>(1);
EventQueue.invokeAndWait(new Runnable() {
+ @Override
public void run() {
AWTGraphicsConfiguration c = (AWTGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capsChosen,
@@ -982,11 +1029,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return config;
}
-
+
protected static String getThreadName() {
return Thread.currentThread().getName();
}
-
+
/**
* A most simple JOGL AWT test entry
*/
@@ -1006,17 +1053,22 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
frame.setSize(128, 128);
glCanvas.addGLEventListener(new GLEventListener() {
+ @Override
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
System.err.println(JoglVersion.getGLInfo(gl, null));
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ @Override
public void display(GLAutoDrawable drawable) { }
+ @Override
public void dispose(GLAutoDrawable drawable) { }
});
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
frame.setVisible(true);
}});
@@ -1026,6 +1078,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
glCanvas.display();
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
frame.dispose();
}});
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 167b99374..152326006 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.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,21 +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 javax.media.opengl.awt;
-import java.nio.ByteBuffer;
-import java.nio.IntBuffer;
-import java.beans.Beans;
-
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.FontMetrics;
@@ -55,13 +51,13 @@ import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
-import javax.swing.JPanel;
+import java.beans.Beans;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
-import javax.media.nativewindow.WindowClosingProtocol;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
-
+import javax.media.nativewindow.WindowClosingProtocol;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
@@ -80,10 +76,7 @@ import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLRunnable;
import javax.media.opengl.Threading;
-
-import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
-import com.jogamp.opengl.util.FBObject;
-import com.jogamp.opengl.util.GLBuffers;
+import javax.swing.JPanel;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
@@ -93,6 +86,10 @@ import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.awt.Java2D;
import jogamp.opengl.awt.Java2DGLContext;
+import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
+import com.jogamp.opengl.util.FBObject;
+import com.jogamp.opengl.util.GLBuffers;
+
// FIXME: Subclasses need to call resetGLFunctionAvailability() on their
// context whenever the displayChanged() function is called on their
// GLEventListeners
@@ -107,9 +104,9 @@ import jogamp.opengl.awt.Java2DGLContext;
#setOpaque}(false). Pixels with resulting OpenGL alpha values less
than 1.0 will be overlaid on any underlying Swing rendering. </P>
<P>
- Notes specific to the Reference Implementation: This component
- attempts to use hardware-accelerated rendering via pbuffers and
- falls back on to software rendering if problems occur.
+ Notes specific to the Reference Implementation: This component
+ attempts to use hardware-accelerated rendering via pbuffers and
+ falls back on to software rendering if problems occur.
Note that because this component attempts to use pbuffers for
rendering, and because pbuffers can not be resized, somewhat
surprising behavior may occur during resize operations; the {@link
@@ -138,7 +135,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private GLCapabilitiesChooser chooser;
private GLContext shareWith;
private int additionalCtxCreationFlags = 0;
-
+
// Width of the actual GLJPanel
private int panelWidth = 0;
private int panelHeight = 0;
@@ -180,6 +177,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
+ @Override
public void run() {
GLJPanel.this.destroy();
}
@@ -198,7 +196,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLJPanel component with a default set of OpenGL
capabilities and using the default OpenGL capabilities selection
- mechanism.
+ mechanism.
* @throws GLException if no default profile is available for the default desktop device.
*/
public GLJPanel() throws GLException {
@@ -207,7 +205,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLJPanel component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
- selection mechanism.
+ selection mechanism.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
public GLJPanel(GLCapabilitiesImmutable userCapsRequest) throws GLException {
@@ -229,8 +227,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
since J2D GL Context must be shared and we can only share one context.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
- public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith)
- throws GLException
+ public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith)
+ throws GLException
{
super();
@@ -252,6 +250,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
this.shareWith = shareWith;
}
+ @Override
public void display() {
if (EventQueue.isDispatchThread()) {
// Want display() to be synchronous, so call paintImmediately()
@@ -280,7 +279,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
animatorPaused = animator.pause();
}
- if(backend.getContext().isCreated()) {
+ if(backend.getContext().isCreated()) {
Threading.invoke(true, disposeAction, getTreeLock());
}
if(null != backend) {
@@ -291,9 +290,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if(animatorPaused) {
animator.resume();
- }
+ }
}
-
+
if(DEBUG) {
System.err.println(getThreadName()+": GLJPanel.dispose() - stop");
}
@@ -302,6 +301,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
/**
* Just an alias for removeNotify
*/
+ @Override
public void destroy() {
removeNotify();
}
@@ -352,11 +352,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
updater.setGraphics(g);
-
+
backend.doPaintComponent(g);
}
-
+
/** Overridden to track when this component is added to a container.
Subclasses which override this method must call
super.addNotify() in their addNotify() method in order to
@@ -393,7 +393,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
<DL><DD><CODE>reshape</CODE> in class <CODE>java.awt.Component</CODE></DD></DL> */
@SuppressWarnings("deprecation")
@Override
-public void reshape(int x, int y, int width, int height) {
+ public void reshape(int x, int y, int width, int height) {
super.reshape(x, y, width, height);
// reshapeX = x;
@@ -411,41 +411,51 @@ public void reshape(int x, int y, int width, int height) {
super.setOpaque(opaque);
}
+ @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 GLContext createContext(GLContext shareWith) {
return (null != backend) ? backend.createContext(shareWith) : null;
}
+ @Override
public void setRealized(boolean realized) {
}
+ @Override
public boolean isRealized() {
return isInitialized;
}
+ @Override
public void setContext(GLContext ctx) {
if (backend == null) {
return;
@@ -456,6 +466,7 @@ public void reshape(int x, int y, int width, int height) {
backend.setContext(ctx);
}
+ @Override
public GLContext getContext() {
if (backend == null) {
return null;
@@ -463,6 +474,7 @@ public void reshape(int x, int y, int width, int height) {
return backend.getContext();
}
+ @Override
public GL getGL() {
if (Beans.isDesignTime()) {
return null;
@@ -471,6 +483,7 @@ public void reshape(int x, int y, int width, int height) {
return (context == null) ? null : context.getGL();
}
+ @Override
public GL setGL(GL gl) {
GLContext context = getContext();
if (context != null) {
@@ -480,6 +493,7 @@ public void reshape(int x, int y, int width, int height) {
return null;
}
+ @Override
public void setAutoSwapBufferMode(boolean onOrOff) {
// In the current implementation this is a no-op. Both the pbuffer
// and pixmap based rendering paths use a single-buffered surface
@@ -488,6 +502,7 @@ public void reshape(int x, int y, int width, int height) {
// Swing portion of the GLJPanel in any of the rendering paths.
}
+ @Override
public boolean getAutoSwapBufferMode() {
// In the current implementation this is a no-op. Both the pbuffer
// and pixmap based rendering paths use a single-buffered surface
@@ -496,7 +511,8 @@ public void reshape(int x, int y, int width, int height) {
// Swing portion of the GLJPanel in any of the rendering paths.
return true;
}
-
+
+ @Override
public void swapBuffers() {
// In the current implementation this is a no-op. Both the pbuffer
// and pixmap based rendering paths use a single-buffered surface
@@ -505,14 +521,16 @@ public void reshape(int x, int y, int width, int height) {
// Swing portion of the GLJPanel in any of the rendering paths.
}
+ @Override
public void setContextCreationFlags(int flags) {
additionalCtxCreationFlags = flags;
}
-
+
+ @Override
public int getContextCreationFlags() {
- return additionalCtxCreationFlags;
+ return additionalCtxCreationFlags;
}
-
+
/** For a translucent GLJPanel (one for which {@link #setOpaque
setOpaque}(false) has been called), indicates whether the
application should preserve the OpenGL color buffer
@@ -529,22 +547,27 @@ public void reshape(int x, int y, int width, int height) {
return oglPipelineEnabled;
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
return backend.getChosenGLCapabilities();
}
+ @Override
public final GLProfile getGLProfile() {
return glProfile;
}
+ @Override
public NativeSurface getNativeSurface() {
throw new GLException("FIXME");
}
+ @Override
public long getHandle() {
throw new GLException("FIXME");
}
+ @Override
public final GLDrawableFactory getFactory() {
return factory;
}
@@ -597,10 +620,12 @@ public void reshape(int x, int y, int width, int height) {
awtWindowClosingProtocol.addClosingListenerOneShot();
}
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
@@ -618,7 +643,7 @@ public void reshape(int x, int y, int width, int height) {
backend.handleReshape();
handleReshape = false;
}
-
+
// This is used as the GLEventListener for the pbuffer-based backend
// as well as the callback mechanism for the other backends
class Updater implements GLEventListener {
@@ -628,6 +653,7 @@ public void reshape(int x, int y, int width, int height) {
this.g = g;
}
+ @Override
public void init(GLAutoDrawable drawable) {
if (!backend.preGL(g)) {
return;
@@ -636,10 +662,12 @@ public void reshape(int x, int y, int width, int height) {
backend.postGL(g, false);
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
drawableHelper.dispose(GLJPanel.this);
}
+ @Override
public void display(GLAutoDrawable drawable) {
if (!backend.preGL(g)) {
return;
@@ -656,6 +684,7 @@ public void reshape(int x, int y, int width, int height) {
backend.postGL(g, true);
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
// This is handled above and dispatched directly to the appropriate context
}
@@ -664,43 +693,49 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public String toString() {
return "AWT-GLJPanel[ "+((null!=backend)?backend.getDrawable().getClass().getName():"null-drawable")+"]";
}
private final Runnable postDisposeAction = new Runnable() {
+ @Override
public void run() {
if (backend != null && !backend.isUsingOwnThreadManagment()) {
backend.destroy();
backend = null;
- isInitialized = false;
+ isInitialized = false;
}
}
- };
+ };
private final Runnable disposeAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.disposeGL(GLJPanel.this, backend.getDrawable(), backend.getContext(), postDisposeAction);
}
- };
+ };
private final Runnable updaterInitAction = new Runnable() {
+ @Override
public void run() {
updater.init(GLJPanel.this);
}
};
private final Runnable updaterDisplayAction = new Runnable() {
+ @Override
public void run() {
updater.display(GLJPanel.this);
}
};
private final Runnable paintImmediatelyAction = new Runnable() {
+ @Override
public void run() {
paintImmediately(0, 0, getWidth(), getHeight());
}
- };
+ };
private int getNextPowerOf2(int number) {
// Workaround for problems where 0 width or height are transiently
@@ -720,7 +755,7 @@ public void reshape(int x, int y, int width, int height) {
protected static String getThreadName() {
return Thread.currentThread().getName();
}
-
+
//----------------------------------------------------------------------
// Implementations of the various backends
//
@@ -731,7 +766,7 @@ public void reshape(int x, int y, int width, int height) {
static interface Backend {
// Create, Destroy, ..
public boolean isUsingOwnThreadManagment();
-
+
// Called each time the backend needs to initialize itself
public void initialize();
@@ -801,6 +836,7 @@ public void reshape(int x, int y, int width, int height) {
private int[] skippixels = new int[1];
private int[] alignment = new int[1];
+ @Override
public void setOpaque(boolean opaque) {
if (opaque != isOpaque()) {
if (offscreenImage != null) {
@@ -810,11 +846,13 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public boolean preGL(Graphics g) {
// Empty in this implementation
return true;
}
+ @Override
public void postGL(Graphics g, boolean isDisplay) {
if (isDisplay) {
// Must now copy pixels from offscreen context into surface
@@ -938,6 +976,7 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public void doPaintComponent(Graphics g) {
doPaintComponentImpl();
if (offscreenImage != null) {
@@ -959,8 +998,10 @@ public void reshape(int x, int y, int width, int height) {
private GLDrawableImpl offscreenDrawable;
private GLContextImpl offscreenContext;
+ @Override
public boolean isUsingOwnThreadManagment() { return false; }
-
+
+ @Override
public void initialize() {
if(DEBUG) {
System.err.println(getThreadName()+": SoftwareBackend: initialize()");
@@ -975,10 +1016,11 @@ public void reshape(int x, int y, int width, int height) {
offscreenDrawable.setRealized(true);
offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith);
offscreenContext.setContextCreationFlags(additionalCtxCreationFlags);
-
+
isInitialized = true;
}
+ @Override
public void destroy() {
if(DEBUG) {
System.err.println(getThreadName()+": SoftwareBackend: destroy() - offscreenContext: "+(null!=offscreenContext)+" - offscreenDrawable: "+(null!=offscreenDrawable));
@@ -997,22 +1039,27 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return (null != offscreenDrawable) ? offscreenDrawable.createContext(shareWith) : null;
}
+ @Override
public void setContext(GLContext ctx) {
offscreenContext=(GLContextImpl)ctx;
}
+ @Override
public GLContext getContext() {
return offscreenContext;
}
+ @Override
public GLDrawable getDrawable() {
return offscreenDrawable;
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (offscreenDrawable == null) {
return null;
@@ -1020,6 +1067,7 @@ public void reshape(int x, int y, int width, int height) {
return offscreenDrawable.getChosenGLCapabilities();
}
+ @Override
public GLProfile getGLProfile() {
if (offscreenDrawable == null) {
return null;
@@ -1027,6 +1075,7 @@ public void reshape(int x, int y, int width, int height) {
return offscreenDrawable.getGLProfile();
}
+ @Override
public void handleReshape() {
destroy();
initialize();
@@ -1039,14 +1088,17 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
protected void doPaintComponentImpl() {
drawableHelper.invokeGL(offscreenDrawable, offscreenContext, updaterDisplayAction, updaterInitAction);
}
+ @Override
protected int getGLPixelType() {
return offscreenContext.getOffscreenContextPixelDataType();
}
+ @Override
protected boolean flipVertically() {
return offscreenContext.offscreenImageNeedsVerticalFlip();
}
@@ -1057,8 +1109,10 @@ public void reshape(int x, int y, int width, int height) {
private int pbufferWidth = 256;
private int pbufferHeight = 256;
+ @Override
public boolean isUsingOwnThreadManagment() { return false; }
-
+
+ @Override
public void initialize() {
if (pbuffer != null) {
throw new InternalError("Creating pbuffer twice without destroying it (memory leak / correctness bug)");
@@ -1073,7 +1127,7 @@ public void reshape(int x, int y, int width, int height) {
pbufferWidth,
pbufferHeight,
shareWith);
- pbuffer.setContextCreationFlags(additionalCtxCreationFlags);
+ pbuffer.setContextCreationFlags(additionalCtxCreationFlags);
pbuffer.addGLEventListener(updater);
isInitialized = true;
} catch (GLException e) {
@@ -1088,6 +1142,7 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public void destroy() {
if(DEBUG) {
System.err.println(getThreadName()+": PbufferBackend: destroy() - pbuffer: "+(null!=pbuffer));
@@ -1098,10 +1153,12 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return (null != pbuffer) ? pbuffer.createContext(shareWith) : null;
}
+ @Override
public void setContext(GLContext ctx) {
if (pbuffer == null && Beans.isDesignTime()) {
return;
@@ -1109,6 +1166,7 @@ public void reshape(int x, int y, int width, int height) {
pbuffer.setContext(ctx);
}
+ @Override
public GLContext getContext() {
// Workaround for crashes in NetBeans GUI builder
if (pbuffer == null && Beans.isDesignTime()) {
@@ -1117,24 +1175,28 @@ public void reshape(int x, int y, int width, int height) {
return pbuffer.getContext();
}
+ @Override
public GLDrawable getDrawable() {
return pbuffer;
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (pbuffer == null) {
return null;
}
return pbuffer.getChosenGLCapabilities();
}
-
+
+ @Override
public GLProfile getGLProfile() {
if (pbuffer == null) {
return null;
}
return pbuffer.getGLProfile();
}
-
+
+ @Override
public void handleReshape() {
// Use factor larger than 2 during shrinks for some hysteresis
float shrinkFactor = 2.5f;
@@ -1192,15 +1254,18 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
protected void doPaintComponentImpl() {
pbuffer.display();
}
+ @Override
protected int getGLPixelType() {
// This seems to be a good choice on all platforms
return GL2.GL_UNSIGNED_INT_8_8_8_8_REV;
}
+ @Override
protected boolean flipVertically() {
return true;
}
@@ -1255,8 +1320,10 @@ public void reshape(int x, int y, int width, int height) {
// comment related to Issue 274 below
private GraphicsConfiguration workaroundConfig;
+ @Override
public boolean isUsingOwnThreadManagment() { return true; }
-
+
+ @Override
public void initialize() {
if(DEBUG) {
System.err.println(getThreadName()+": J2DOGL: initialize()");
@@ -1265,8 +1332,10 @@ public void reshape(int x, int y, int width, int height) {
isInitialized = true;
}
+ @Override
public void destroy() {
Java2D.invokeWithOGLContextCurrent(null, new Runnable() {
+ @Override
public void run() {
if(DEBUG) {
System.err.println(getThreadName()+": J2DOGL: destroy() - joglContext: "+(null!=joglContext)+" - joglDrawable: "+(null!=joglDrawable));
@@ -1284,10 +1353,12 @@ public void reshape(int x, int y, int width, int height) {
});
}
+ @Override
public void setOpaque(boolean opaque) {
// Empty in this implementation
}
+ @Override
public GLContext createContext(GLContext shareWith) {
if(null != shareWith) {
throw new GLException("J2DOGLBackend cannot create context w/ additional shared context, since it already needs to share the context w/ J2D.");
@@ -1295,32 +1366,39 @@ public void reshape(int x, int y, int width, int height) {
return (null != joglDrawable && null != j2dContext) ? joglDrawable.createContext(j2dContext) : null;
}
+ @Override
public void setContext(GLContext ctx) {
joglContext=ctx;
}
+ @Override
public GLContext getContext() {
return joglContext;
}
+ @Override
public GLDrawable getDrawable() {
return joglDrawable;
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
// FIXME: should do better than this; is it possible to using only platform-independent code?
return new GLCapabilities(null);
}
+ @Override
public GLProfile getGLProfile() {
// FIXME: should do better than this; is it possible to using only platform-independent code?
return GLProfile.getDefault(GLProfile.getDefaultDevice());
}
+ @Override
public void handleReshape() {
// Empty in this implementation
}
+ @Override
public boolean preGL(Graphics g) {
GL2 gl = joglContext.getGL().getGL2();
// Set up needed state in JOGL context from Java2D context
@@ -1403,13 +1481,13 @@ public void reshape(int x, int y, int width, int height) {
int[] height = new int[1];
gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2.GL_TEXTURE_WIDTH, width, 0);
gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2.GL_TEXTURE_HEIGHT, height, 0);
-
+
gl.glGenRenderbuffers(1, frameBufferDepthBuffer, 0);
if (DEBUG) {
System.err.println(getThreadName()+": GLJPanel: Generated frameBufferDepthBuffer " + frameBufferDepthBuffer[0] +
" with width " + width[0] + ", height " + height[0]);
}
-
+
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, frameBufferDepthBuffer[0]);
// FIXME: may need a loop here like in Java2D
gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL2GL3.GL_DEPTH_COMPONENT24, width[0], height[0]);
@@ -1457,6 +1535,7 @@ public void reshape(int x, int y, int width, int height) {
return true;
}
+ @Override
public void postGL(Graphics g, boolean isDisplay) {
// Cause OpenGL pipeline to flush its results because
// otherwise it's possible we will buffer up multiple frames'
@@ -1473,6 +1552,7 @@ public void reshape(int x, int y, int width, int height) {
}
}
+ @Override
public void doPaintComponent(final Graphics g) {
// This is a workaround for an issue in the Java 2D / JOGL
// bridge (reported by an end user as JOGL Issue 274) where Java
@@ -1498,10 +1578,12 @@ public void reshape(int x, int y, int width, int height) {
getDefaultScreenDevice().
getDefaultConfiguration();
}
- Java2D.invokeWithOGLSharedContextCurrent(workaroundConfig, new Runnable() { public void run() {}});
+ Java2D.invokeWithOGLSharedContextCurrent(workaroundConfig, new Runnable() { @Override
+ public void run() {}});
}
Java2D.invokeWithOGLContextCurrent(g, new Runnable() {
+ @Override
public void run() {
if (DEBUG) {
System.err.println(getThreadName()+": GLJPanel.invokeWithOGLContextCurrent");
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;