diff options
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 77 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 41 |
2 files changed, 37 insertions, 81 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index ec834e02f..2d5e12429 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -155,6 +155,11 @@ import jogamp.opengl.awt.AWTTilePainter; * <ul> * <li><pre>sun.awt.noerasebackground=true</pre></li> * </ul> + * + * <a name="contextSharing"><h5>OpenGL Context Sharing</h5></a> + * To share a {@link GLContext} see the following note in the documentation overview: + * <a href="../../../spec-overview.html#SHARING">context sharing</a> + * as well as {@link GLSharedContextSetter}. */ @SuppressWarnings("serial") @@ -200,6 +205,9 @@ 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. + <p> + See details about <a href="#contextSharing">OpenGL context sharing</a>. + </p> * @throws GLException if no default profile is available for the default desktop device. */ public GLCanvas() throws GLException { @@ -209,27 +217,14 @@ 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. + <p> + See details about <a href="#contextSharing">OpenGL context sharing</a>. + </p> * @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(final GLCapabilitiesImmutable capsReqUser) throws GLException { - this(capsReqUser, null, null, null); - } - - /** Creates a new GLCanvas component with the requested set of - OpenGL capabilities, using the default OpenGL capabilities - selection mechanism, on the default screen device. - * This constructor variant also supports using a shared GLContext. - * - * @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) - * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable)} - * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. - */ - public GLCanvas(final GLCapabilitiesImmutable capsReqUser, final GLContext shareWith) - throws GLException - { - this(capsReqUser, null, shareWith, null); + this(capsReqUser, null, null); } /** Creates a new GLCanvas component. The passed GLCapabilities @@ -242,6 +237,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing which to create the GLCanvas; the GLDrawableFactory uses the default screen device of the local GraphicsEnvironment if null is passed for this argument. + <p> + See details about <a href="#contextSharing">OpenGL context sharing</a>. + </p> * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ public GLCanvas(final GLCapabilitiesImmutable capsReqUser, @@ -249,34 +247,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing final GraphicsDevice device) throws GLException { - this(capsReqUser, chooser, null, device); - } - - /** Creates a new GLCanvas component. The passed GLCapabilities - specifies the OpenGL capabilities for the component; if null, a - default set of capabilities is used. The GLCapabilitiesChooser - specifies the algorithm for selecting one of the available - GLCapabilities for the component; a DefaultGLCapabilitesChooser - is used if null is passed for this argument. The passed - GLContext specifies an OpenGL context with which to share - textures, display lists and other OpenGL state, and may be null - if sharing is not desired. See the note in the overview - documentation on <a - href="../../../spec-overview.html#SHARING">context - 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. - * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. - * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable, GLCapabilitiesChooser, GraphicsDevice)} - * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. - */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, - final GLCapabilitiesChooser chooser, - final GLContext shareWith, - GraphicsDevice device) - throws GLException - { /* * Determination of the native window is made in 'super.addNotify()', * which creates the native peer using AWT's GraphicsConfiguration. @@ -287,29 +257,28 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing super(); if(null==capsReqUser) { - capsReqUser = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDevice())); + this.capsReqUser = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDevice())); } else { // don't allow the user to change data - capsReqUser = (GLCapabilitiesImmutable) capsReqUser.cloneMutable(); + this.capsReqUser = (GLCapabilitiesImmutable) capsReqUser.cloneMutable(); } - if(!capsReqUser.isOnscreen()) { + if( !this.capsReqUser.isOnscreen() ) { setShallUseOffscreenLayer(true); // trigger offscreen layer - if supported } if(null==device) { final GraphicsConfiguration gc = super.getGraphicsConfiguration(); if(null!=gc) { - device = gc.getDevice(); + this.device = gc.getDevice(); + } else { + this.device = null; } + } else { + this.device = device; } // instantiation will be issued in addNotify() - this.capsReqUser = capsReqUser; this.chooser = chooser; - if( null != shareWith ) { - helper.setSharedContext(null, shareWith); - } - this.device = device; this.addHierarchyListener(hierarchyListener); this.isShowing = isShowing(); diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index eca99c6c0..549b6e96f 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -170,6 +170,10 @@ import com.jogamp.opengl.util.texture.TextureState; It is recommended to reset those states to default when leaving the {@link GLEventListener#display(GLAutoDrawable)} method! We may change this behavior in the future, i.e. preserve all influencing states. </p> + <a name="contextSharing"><h5>OpenGL Context Sharing</h5></a> + To share a {@link GLContext} see the following note in the documentation overview: + <a href="../../../spec-overview.html#SHARING">context sharing</a> + as well as {@link GLSharedContextSetter}. */ @SuppressWarnings("serial") @@ -298,6 +302,9 @@ 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. + <p> + See details about <a href="#contextSharing">OpenGL context sharing</a>. + </p> * @throws GLException if no default profile is available for the default desktop device. */ public GLJPanel() throws GLException { @@ -307,10 +314,13 @@ 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. + <p> + See details about <a href="#contextSharing">OpenGL context sharing</a>. + </p> * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ public GLJPanel(final GLCapabilitiesImmutable userCapsRequest) throws GLException { - this(userCapsRequest, null, null); + this(userCapsRequest, null); } /** Creates a new GLJPanel component. The passed GLCapabilities @@ -319,34 +329,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing specifies the algorithm for selecting one of the available GLCapabilities for the component; a DefaultGLCapabilitesChooser is used if null is passed for this argument. + <p> + See details about <a href="#contextSharing">OpenGL context sharing</a>. + </p> * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser) throws GLException { - this(userCapsRequest, chooser, null); - } - - /** Creates a new GLJPanel component. The passed GLCapabilities - specifies the OpenGL capabilities for the component; if null, a - default set of capabilities is used. The GLCapabilitiesChooser - specifies the algorithm for selecting one of the available - GLCapabilities for the component; a DefaultGLCapabilitesChooser - is used if null is passed for this argument. The passed - GLContext specifies an OpenGL context with which to share - textures, display lists and other OpenGL state, and may be null - if sharing is not desired. See the note in the overview documentation on - <a href="../../../spec-overview.html#SHARING">context sharing</a>. - <P> - Note: Sharing cannot be enabled using J2D OpenGL FBO sharing, - 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. - * @deprecated Use {@link #GLJPanel(GLCapabilitiesImmutable, GLCapabilitiesChooser)} - * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. - */ - public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser, final GLContext shareWith) - throws GLException - { super(); // Works around problems on many vendors' cards; we don't need a @@ -366,9 +356,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing this.chooser = chooser; helper = new GLDrawableHelper(); - if( null != shareWith ) { - helper.setSharedContext(null, shareWith); - } autoSwapBufferMode = helper.getAutoSwapBufferMode(); this.setFocusable(true); // allow keyboard input! |