From ec2d94ca26ddab8ec67135ebc5f2d0a43f6a4c25 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Jul 2014 01:11:00 +0200 Subject: Bug 1031: Remove Deprecated Classes and Methods (JOGL) Removed Deprecated Class: - com/jogamp/opengl/util/TGAWriter.java - Use TextureIO w/ .tga suffix - com/jogamp/opengl/util/awt/Screenshot.java - Use: - com.jogamp.opengl.util.GLReadBufferUtil, or - com.jogamp.opengl.util.awt.AWTGLReadBufferUtil The latter for reading into AWT BufferedImage See: TestBug461FBOSupersamplingSwingAWT, TestBug605FlippedImageAWT - javax/media/opengl/GLPbuffer.java - Use: caps.setPBuffer(true); final GLAutoDrawable pbuffer = GLDrawableFactory.getFactory( caps.getGLProfile() ).createOffscreenAutoDrawable(null, caps, null, 512, 512); - See: TestPBufferDeadlockAWT, .. Removed Deprecated Methods: - Constructor of AWT-GLCanvas, SWT-GLCanvas, AWT-GLJPanel with argument 'final GLContext shareWith' See GLSharedContextSetter, i.e. glCanvas.setSharedContext(..) ! - GLDrawableFactory.createOffscreenAutoDrawable(..) with argument 'final GLContext shareWith' See GLSharedContextSetter, i.e. offscreenAutoDrawable.setSharedContext(..) ! - GLDrawableFactory.createGLPbuffer(..), see above! - com.jogamp.opengl.util.av.AudioSink 'enqueueData(AudioDataFrame audioDataFrame)', use 'enqueueData(int, ByteBuffer, int)' - GLSharedContextSetter.areAllGLEventListenerInitialized(), migrated to GLAutoDrawable ! - GLBase's - glGetBoundBuffer(int), use getBoundBuffer(int) - glGetBufferSize(int), use getBufferStorage(int).getSize() - glIsVBOArrayBound(), use isVBOArrayBound() - glIsVBOElementArrayBound(), use isVBOElementArrayBound() - NEWT MouseEvent.BUTTON_NUMBER, use BUTTON_COUNT --- .../classes/javax/media/opengl/GLAutoDrawable.java | 5 + src/jogl/classes/javax/media/opengl/GLBase.java | 16 ---- .../javax/media/opengl/GLDrawableFactory.java | 106 +++------------------ src/jogl/classes/javax/media/opengl/GLPbuffer.java | 62 ------------ .../javax/media/opengl/GLSharedContextSetter.java | 6 -- src/jogl/classes/javax/media/opengl/Threading.java | 4 +- .../classes/javax/media/opengl/awt/GLCanvas.java | 77 +++++---------- .../classes/javax/media/opengl/awt/GLJPanel.java | 41 +++----- 8 files changed, 59 insertions(+), 258 deletions(-) delete mode 100644 src/jogl/classes/javax/media/opengl/GLPbuffer.java (limited to 'src/jogl/classes/javax/media/opengl') diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java index bf8fe65ac..377dce190 100644 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java @@ -198,6 +198,11 @@ public interface GLAutoDrawable extends GLDrawable { */ public int getGLEventListenerCount(); + /** + * Returns true if all added {@link GLEventListener} are initialized, otherwise false. + */ + boolean areAllGLEventListenerInitialized(); + /** * Returns the {@link GLEventListener} at the given index of this drawable queue. * @param index Position of the listener to be returned. diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index c808399b8..48455c525 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -504,10 +504,6 @@ public interface GLBase { /** Aliased entrypoint of void {@native glDepthRange}(GLclampd depth); and void {@native glDepthRangef}(GLclampf depth); . */ public void glDepthRange(double zNear, double zFar); - /** - * @deprecated Avoid original GL API namespace conflict. Use {@link #getBoundBuffer(int)} - */ - public int glGetBoundBuffer(int target); /** * @param target a GL buffer (VBO) target as used in {@link GL#glBindBuffer(int, int)}, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}, {@link GL#GL_ARRAY_BUFFER}, .. * @return the GL buffer name bound to a target via {@link GL#glBindBuffer(int, int)} or 0 if unbound. @@ -515,10 +511,6 @@ public interface GLBase { */ public int getBoundBuffer(int target); - /** - * @deprecated Use {@link #getBufferStorage(int)}. - */ - public long glGetBufferSize(int bufferName); /** * @param bufferName a GL buffer name, generated with e.g. {@link GL#glGenBuffers(int, int[], int)} and used in {@link GL#glBindBuffer(int, int)}, {@link GL#glBufferData(int, long, java.nio.Buffer, int)} or {@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)}. * @return the size of the given GL buffer storage, see {@link GLBufferStorage} @@ -579,19 +571,11 @@ public interface GLBase { */ public GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) throws GLException; - /** - * @deprecated Avoid original GL API namespace conflict. Use {@link #isVBOArrayBound()} - */ - public boolean glIsVBOArrayBound(); /** * @return true if a VBO is bound to {@link GL#GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false */ public boolean isVBOArrayBound(); - /** - * @deprecated Avoid original GL API namespace conflict. Use {@link #isVBOElementArrayBound()} - */ - public boolean glIsVBOElementArrayBound(); /** * @return true if a VBO is bound to {@link GL#GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false */ diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 6e7caf8f8..82808a3cb 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -59,10 +59,10 @@ import javax.media.nativewindow.UpstreamSurfaceHook; import jogamp.opengl.Debug; -/**

Provides a virtual machine- and operating system-independent - mechanism for creating {@link GLDrawable}s.

- -

The {@link javax.media.opengl.GLCapabilities} objects passed +/**

Provides a virtual machine- and operating system-independent + mechanism for creating {@link GLDrawable}s. +

+

The {@link javax.media.opengl.GLCapabilities} objects passed in to the various factory methods are used as a hint for the properties of the returned drawable. The default capabilities selection algorithm (equivalent to passing in a null {@link @@ -72,9 +72,10 @@ import jogamp.opengl.Debug; GLCapabilitiesChooser} which can select from the available pixel formats. The GLCapabilitiesChooser mechanism may not be supported by all implementations or on all platforms, in which case any - passed GLCapabilitiesChooser will be ignored.

+ passed GLCapabilitiesChooser will be ignored. +

-

Because of the multithreaded nature of the Java platform's +

Because of the multithreaded nature of the Java platform's Abstract Window Toolkit, it is typically not possible to immediately reject a given {@link GLCapabilities} as being unsupportable by either returning null from the creation routines or @@ -83,14 +84,15 @@ import jogamp.opengl.Debug; implementation will cause a {@link GLException} to be raised during the first repaint of the {@link javax.media.opengl.awt.GLCanvas} or {@link javax.media.opengl.awt.GLJPanel} if the capabilities can not be met.
- {@link javax.media.opengl.GLPbuffer} are always - created immediately and their creation will fail with a - {@link javax.media.opengl.GLException} if errors occur.

+ {@link GLOffscreenAutoDrawable} are created lazily, + see {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) createOffscreenAutoDrawable(..)}. +

-

The concrete GLDrawableFactory subclass instantiated by {@link +

The concrete GLDrawableFactory subclass instantiated by {@link #getFactory getFactory} can be changed by setting the system property opengl.factory.class.name to the - fully-qualified name of the desired class.

+ fully-qualified name of the desired class. +

*/ public abstract class GLDrawableFactory { @@ -469,62 +471,16 @@ public abstract class GLDrawableFactory { public abstract GLDrawable createGLDrawable(NativeSurface target) throws IllegalArgumentException, GLException; - /** - * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable} - * incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions. - *

- * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized} - * and it's {@link GLContext} assigned but not yet made current. - *

- *

- * In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e. - * {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} == true, - * it is auto-configured. Auto configuration will set {@link GLCapabilitiesImmutable caps} to offscreen - * and FBO or Pbuffer, whichever is available in that order. - *

- *

- * A FBO based auto drawable, {@link GLOffscreenAutoDrawable.FBO}, is created if both {@link GLCapabilitiesImmutable#isFBO() caps.isFBO()} - * and {@link GLContext#isFBOAvailable(AbstractGraphicsDevice, GLProfile) canCreateFBO(device, caps.getGLProfile())} is true. - *

- *

- * A Pbuffer based auto drawable is created if both {@link GLCapabilitiesImmutable#isPBuffer() caps.isPBuffer()} - * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true. - *

- *

- * If neither FBO nor Pbuffer is available, - * a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated. - *

- *

- * The resulting {@link GLOffscreenAutoDrawable} has it's own independent device instance using device details. - *

- * - * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be null for the platform's default device. - * @param caps the requested GLCapabilties - * @param chooser the custom chooser, may be null for default - * @param width the requested offscreen width - * @param height the requested offscreen height - * @return the created and initialized offscreen {@link GLOffscreenAutoDrawable} instance - * - * @throws GLException if any window system-specific errors caused - * the creation of the Offscreen to fail. - * - * @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) - * @deprecated Use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) - */ - public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, - GLCapabilitiesImmutable caps, - GLCapabilitiesChooser chooser, - int width, int height, - GLContext shareWith) throws GLException; - /** * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable} * incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions. *

* The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized} * without an assigned {@link GLContext}, hence not initialized completely.
+ * * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)} * or it will be created lazily at the 1st {@link GLAutoDrawable#display() display()} method call.
+ * * Lazy {@link GLContext} creation will take a shared {@link GLContext} into account * which has been set {@link GLOffscreenAutoDrawable#setSharedContext(GLContext) directly} * or {@link GLOffscreenAutoDrawable#setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}. @@ -716,38 +672,6 @@ public abstract class GLDrawableFactory { */ public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp); - /** - * Creates a GLPbuffer {@link GLAutoDrawable} with the given capabilites and dimensions. - *

- * The GLPbuffer drawable is realized and initialized eagerly. - *

- * - * See the note in the overview documentation in {@link GLSharedContextSetter} and on - * context sharing. - * - * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device. - * @param capabilities the requested capabilities - * @param chooser the custom chooser, may be null for default - * @param initialWidth initial width of pbuffer - * @param initialHeight initial height of pbuffer - * @param shareWith a shared GLContext this GLPbuffer shall use - * - * @return the created and initialized {@link GLPbuffer} instance - * - * @throws GLException if any window system-specific errors caused - * the creation of the GLPbuffer to fail. - * - * @deprecated {@link GLPbuffer} is deprecated, use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)} - */ - public abstract GLPbuffer createGLPbuffer(AbstractGraphicsDevice device, - GLCapabilitiesImmutable capabilities, - GLCapabilitiesChooser chooser, - int initialWidth, - int initialHeight, - GLContext shareWith) - throws GLException; - - //---------------------------------------------------------------------- // Methods for interacting with third-party OpenGL libraries diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java deleted file mode 100644 index f36a4bf29..000000000 --- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * 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; - -/** Provides offscreen rendering support via pbuffers. The principal - addition of this interface is a {@link #destroy} method to - deallocate the pbuffer and its associated resources. It also - contains experimental methods for accessing the pbuffer's contents - as a texture map and enabling rendering to floating-point frame - buffers. These methods are not guaranteed to be supported on all - platforms and may be deprecated in a future release. - - @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)} - via {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext) GLDrawableFactory.createOffscreenAutoDrawable(..)}. - */ -public interface GLPbuffer extends GLAutoDrawable { - /** Destroys the native resources associated with this pbuffer. It - is not valid to call display() or any other routines on this - pbuffer after it has been destroyed. Before destroying the - pbuffer, the application must destroy any additional OpenGL - contexts which have been created for the pbuffer via {@link - #createContext}. */ - @Override - public void destroy(); -} diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java index 2ea4e4cd6..11ed648c2 100644 --- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java +++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java @@ -98,12 +98,6 @@ package javax.media.opengl; *

*/ public interface GLSharedContextSetter extends GLAutoDrawable { - /** - * Returns true if all {@link GLEventListener} are initialized, otherwise false. - * @deprecated Promote method to {@link GLAutoDrawable} - */ - boolean areAllGLEventListenerInitialized(); - /** * Specifies an {@link GLContext OpenGL context}, which shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}. *

diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java index 3ee233303..6c64cbe31 100644 --- a/src/jogl/classes/javax/media/opengl/Threading.java +++ b/src/jogl/classes/javax/media/opengl/Threading.java @@ -129,8 +129,8 @@ public class Threading { consequences and are prepared to enforce some amount of threading restrictions in their applications. Disabling single-threading, for example, may have unintended consequences - on GLAutoDrawable implementations such as GLCanvas, GLJPanel and - GLPbuffer. Currently there is no supported way to re-enable it + on GLAutoDrawable implementations such as GLCanvas and GLJPanel. + Currently there is no supported way to re-enable it once disabled, partly to discourage careless use of this method. This method should be called as early as possible in an application. */ 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; *

+ * + *
OpenGL Context Sharing
+ * To share a {@link GLContext} see the following note in the documentation overview: + * context sharing + * 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. +

+ See details about OpenGL context sharing. +

* @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. +

+ See details about OpenGL context sharing. +

* @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,40 +237,15 @@ 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. +

+ See details about OpenGL context sharing. +

* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ public GLCanvas(final GLCapabilitiesImmutable capsReqUser, final GLCapabilitiesChooser chooser, 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 context - sharing. 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()', @@ -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.

+
OpenGL Context Sharing
+ To share a {@link GLContext} see the following note in the documentation overview: + context sharing + 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. +

+ See details about OpenGL context sharing. +

* @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. +

+ See details about OpenGL context sharing. +

* @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,33 +329,13 @@ 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. +

+ See details about OpenGL context sharing. +

* @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 - context sharing. -

- 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(); @@ -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! -- cgit v1.2.3