diff options
author | Kenneth Russel <[email protected]> | 2003-07-08 09:20:04 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2003-07-08 09:20:04 +0000 |
commit | 4f936be964c9e8613a5e43e1d88490ff7f550ec9 (patch) | |
tree | 74a2c01c6093d89ac123d08642b11a2007cc99e2 /src/net/java/games/jogl/GLDrawableFactory.java | |
parent | 93d272a0525ec57aa3cd584f15cde6cf2a637e0c (diff) |
Added sharing of display lists and textures among OpenGL contexts
through new methods in GLDrawableFactory; GLContext has not been
exposed in the public API. Tested with new simple TestContextSharing
demonstration on Windows, Linux and Mac OS X.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@18 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/GLDrawableFactory.java')
-rw-r--r-- | src/net/java/games/jogl/GLDrawableFactory.java | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/src/net/java/games/jogl/GLDrawableFactory.java b/src/net/java/games/jogl/GLDrawableFactory.java index 17d5779df..79109771c 100644 --- a/src/net/java/games/jogl/GLDrawableFactory.java +++ b/src/net/java/games/jogl/GLDrawableFactory.java @@ -77,13 +77,36 @@ public class GLDrawableFactory { /** Creates a {@link GLCanvas} with the specified capabilities using the default capabilities selection algorithm. */ public GLCanvas createGLCanvas(GLCapabilities capabilities) { - return createGLCanvas(capabilities, null); + return createGLCanvas(capabilities, null, null); + } + + /** Creates a {@link GLCanvas} with the specified capabilities using + the default capabilities selection algorithm. The canvas will + share textures and display lists with the specified {@link + GLDrawable}; the drawable must either be null or have been + fabricated from this factory or by classes in this package. A + null drawable indicates no sharing. */ + public GLCanvas createGLCanvas(GLCapabilities capabilities, GLDrawable shareWith) { + return createGLCanvas(capabilities, null, shareWith); } /** Creates a {@link GLCanvas} with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the {@link DefaultGLCapabilitiesChooser}. */ public GLCanvas createGLCanvas(GLCapabilities capabilities, GLCapabilitiesChooser chooser) { + return createGLCanvas(capabilities, chooser, null); + } + + /** Creates a {@link GLCanvas} with the specified capabilities using + the supplied capabilities selection algorithm. A null chooser is + equivalent to using the {@link DefaultGLCapabilitiesChooser}. + The canvas will share textures and display lists with the + specified {@link GLDrawable}; the drawable must either be null + or have been fabricated from this factory or by classes in this + package. A null drawable indicates no sharing. */ + public GLCanvas createGLCanvas(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GLDrawable shareWith) { // FIXME: do we need to select a GraphicsConfiguration here as in // GL4Java? If so, this class will have to be made abstract and // we'll have to provide hooks into this package to get at the @@ -91,22 +114,45 @@ public class GLDrawableFactory { if (chooser == null) { chooser = new DefaultGLCapabilitiesChooser(); } - return new GLCanvas(capabilities, chooser); + return new GLCanvas(capabilities, chooser, shareWith); } /** Creates a {@link GLJPanel} with the specified capabilities using the default capabilities selection algorithm. */ public GLJPanel createGLJPanel(GLCapabilities capabilities) { - return createGLJPanel(capabilities, null); + return createGLJPanel(capabilities, null, null); + } + + /** Creates a {@link GLJPanel} with the specified capabilities using + the default capabilities selection algorithm. The panel will + share textures and display lists with the specified {@link + GLDrawable}; the drawable must either be null or have been + fabricated from this factory or by classes in this package. A + null drawable indicates no sharing. */ + public GLJPanel createGLJPanel(GLCapabilities capabilities, GLDrawable shareWith) { + return createGLJPanel(capabilities, null, shareWith); } /** Creates a {@link GLJPanel} with the specified capabilities using the supplied capabilities selection algorithm. A null chooser is equivalent to using the {@link DefaultGLCapabilitiesChooser}. */ public GLJPanel createGLJPanel(GLCapabilities capabilities, GLCapabilitiesChooser chooser) { + return createGLJPanel(capabilities, chooser, null); + } + + /** Creates a {@link GLJPanel} with the specified capabilities using + the supplied capabilities selection algorithm. A null chooser is + equivalent to using the {@link DefaultGLCapabilitiesChooser}. + The panel will share textures and display lists with the + specified {@link GLDrawable}; the drawable must either be null + or have been fabricated from this factory or by classes in this + package. A null drawable indicates no sharing. */ + public GLJPanel createGLJPanel(GLCapabilities capabilities, + GLCapabilitiesChooser chooser, + GLDrawable shareWith) { if (chooser == null) { chooser = new DefaultGLCapabilitiesChooser(); } - return new GLJPanel(capabilities, chooser); + return new GLJPanel(capabilities, chooser, shareWith); } } |