diff options
author | Sven Gothel <[email protected]> | 2011-07-07 03:39:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-07 03:39:43 +0200 |
commit | 29cc5fa0375026c09bcbfed16627fe9eb6c97846 (patch) | |
tree | aefd65d00e5e9a6fa4e28a54f090737d65d37f09 /src/jogl/classes/javax/media/opengl/awt | |
parent | c9903cf9d4ceda09ec07ef340f8aa3d0a104e23a (diff) |
GLProfile: Initialization fix and clarifications ( GLExceptions on n/a profiles )
- GLProfile.initSingleton(boolean) (implicit or explicit) won't
throw any exception anymore. Followup 'GLProfile GLProfile.get(..)'
calls will throw a GLException, if n/a.
Availability maybe queried via GLProfile.isAvailable(..).
- GLCapabilties, GLCanvas, GLJPanel: Clarify case where GLException maybe thrown,
i.e. no default GLProfile available on default device.
- Remove redundant GLProfile.is<ProfileName>Available(..)
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 22 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 19 |
2 files changed, 29 insertions, 12 deletions
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 160cdce51..80e042dd3 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -165,17 +165,20 @@ 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. */ - public GLCanvas() { + mechanism, on the default screen device. + * @throws GLException if no default profile is available for the default desktop device. + */ + public GLCanvas() throws GLException { this(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. + * @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) { + public GLCanvas(GLCapabilitiesImmutable capsReqUser) throws GLException { this(capsReqUser, null, null, null); } @@ -184,9 +187,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing 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) */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith) { + public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith) + throws GLException + { this(capsReqUser, null, shareWith, null); } @@ -204,11 +210,15 @@ 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) { + GraphicsDevice device) + throws GLException + { /* * Determination of the native window is made in 'super.addNotify()', * which creates the native peer using AWT's GraphicsConfiguration. diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 2d58584f7..76d982813 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -199,15 +199,19 @@ 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. */ - public GLJPanel() { + mechanism. + * @throws GLException if no default profile is available for the default desktop device. + */ + public GLJPanel() throws GLException { this(null); } /** Creates a new GLJPanel component with the requested set of OpenGL capabilities, using the default OpenGL capabilities - selection mechanism. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest) { + 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 { this(userCapsRequest, null, null); } @@ -224,8 +228,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing <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. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) { + public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) + throws GLException + { super(); // Works around problems on many vendors' cards; we don't need a @@ -235,7 +242,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (userCapsRequest != null) { caps = (GLCapabilities) userCapsRequest.cloneMutable(); } else { - caps = new GLCapabilities(null); + caps = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDesktopDevice())); } caps.setDoubleBuffered(false); offscreenCaps = caps; |