summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-05 02:54:59 -0700
committerSven Gothel <[email protected]>2009-10-05 02:54:59 -0700
commit76bf2e5a7f23def0a3bf2b688791b593ecb283ab (patch)
tree84b7b2a25cc38450dc83a78d1f1ed165195a599e /src/jogl/classes/javax/media
parent59257476777104ff3f117d87a8205161cb800abf (diff)
GLDrawableFactory Cleanup (-> On- Offscreen and PBuffer)
- Base all PBuffer/Offscreen GLDrawable creators on a prev. created 'NativeWindow + SurfaceChangeable' instance. Simplifies implementation path. This also removes the almost cyclic referencing of GLWindow -> OffscreenWindow GLWindow -> Drawable -> NullWindow -> OffscreenWindow Now it is just GLWindow -> OffscreenWindow GLWindow -> Drawable -> OffscreenWindow - createGLDrawable() shall be used for all types now, especially if you want to pass the offscreen NativeWindow and benefit from the surfaceChangedListener etc .. - Add public createOffscreenDrawable(..) - EGLDrawable: - Query surface only if not 0 - [re]create surface only if needed, using 'ownEGL*' flag for destruction only.
Diffstat (limited to 'src/jogl/classes/javax/media')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java53
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java9
2 files changed, 28 insertions, 34 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index aade017eb..b7c81cbed 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -177,28 +177,23 @@ public abstract class GLDrawableFactory {
public void shutdown() {
}
+ //----------------------------------------------------------------------
+ // Methods to create high-level objects
+
/**
- * Returns a GLDrawable according to it's chosen Capabilities.
+ * Returns a GLDrawable according to it's chosen Capabilities,<br>
+ * which determines pixel format, on- and offscreen incl. PBuffer type.
* <p>
- * The chosen Capabilties are referenced within the target
+ * The native platform's chosen Capabilties are referenced within the target
* NativeWindow's AbstractGraphicsConfiguration.<p>
*
* In case {@link javax.media.nativewindow.Capabilties#isOnscreen()} is true,<br>
- * it wraps a platform-specific window system
- * object, such as an AWT or LCDUI Canvas.
- * On platforms which support pixel format, the NativeWindow's AbstractGraphicsConfiguration
- * is being used, hence the <code>chooser</code> is redundant in this case.
+ * an onscreen GLDrawable will be realized.
* <p>
* In case {@link javax.media.nativewindow.Capabilties#isOnscreen()} is false,<br>
* either a Pbuffer drawable is created if {@link javax.media.opengl.GLCapabilities#isPBuffer()} is true,<br>
- * or a simple offscreen drawable is creates, the latter is unlikely to be hardware accelerated.<br>
- * The <code>chooser</code> will be used to determine the pixel format.
+ * or a simple offscreen drawable is creates. The latter is unlikely to be hardware accelerated.<br>
* <p>
- * GLCapabilities, or if the passed GLCapabilities object is null,
- * uses a default set of capabilities. On these platforms, uses
- * either the supplied GLCapabilitiesChooser object, or if the
- * passed GLCapabilitiesChooser object is null, uses a
- * DefaultGLCapabilitiesChooser instance.
*
* @throws IllegalArgumentException if the passed target is null
* @throws GLException if any window system-specific errors caused
@@ -206,17 +201,19 @@ public abstract class GLDrawableFactory {
*
* @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
*/
- public abstract GLDrawable createGLDrawable(NativeWindow target, GLCapabilitiesChooser chooser)
+ public abstract GLDrawable createGLDrawable(NativeWindow target)
throws IllegalArgumentException, GLException;
- /**
- * @see #createGLDrawable(NativeWindow, GLCapabilitiesChooser)
+ /**
+ * Creates a Offscreen GLDrawable with the given capabilites and dimensions. <P>
+ *
+ * @throws GLException if any window system-specific errors caused
+ * the creation of the Offscreen to fail.
*/
- public abstract GLDrawable createGLDrawable(NativeWindow target)
- throws IllegalArgumentException, GLException;
-
- //----------------------------------------------------------------------
- // Methods to create high-level objects
+ public abstract GLDrawable createOffscreenDrawable(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ int width, int height)
+ throws GLException;
/**
* Returns true if it is possible to create a GLPbuffer. Some older
@@ -225,19 +222,15 @@ public abstract class GLDrawableFactory {
public abstract boolean canCreateGLPbuffer();
/**
- * Creates a GLPbuffer with the given drawable, which must be Pbuffer drawable,
- * created by {@link #createGLDrawable}.<p>
- *
- * See the note in the overview documentation on
- * <a href="../../../overview-summary.html#SHARING">context sharing</a>.
+ * Creates a Pbuffer GLDrawable with the given capabilites and dimensions. <P>
*
* @throws GLException if any window system-specific errors caused
* the creation of the GLPbuffer to fail.
- *
- * @see #createGLDrawable(NativeWindow, GLCapabilitiesChooser)
*/
- public abstract GLPbuffer createGLPbuffer(GLDrawable pbufferDrawable,
- GLContext shareWith)
+ public abstract GLDrawable createGLPbufferDrawable(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ int initialWidth,
+ int initialHeight)
throws GLException;
/**
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index fe55b2dbd..e4758211e 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -909,10 +909,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
public void initialize() {
// Fall-through path: create an offscreen context instead
- offscreenDrawable = factory.createOffscreenDrawable(offscreenCaps,
- chooser,
- Math.max(1, panelWidth),
- Math.max(1, panelHeight));
+ offscreenDrawable = (GLDrawableImpl) factory.createOffscreenDrawable(
+ offscreenCaps,
+ chooser,
+ Math.max(1, panelWidth),
+ Math.max(1, panelHeight));
offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith);
offscreenContext.setSynchronized(true);
isInitialized = true;