aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-05-30 08:40:44 +0000
committerKenneth Russel <[email protected]>2008-05-30 08:40:44 +0000
commit1ff64b2c2aa841964343b21aff2927abc510f093 (patch)
tree6adf52f31391643173b2f167bbcec83b72f36a54 /src
parentb5aed7df3ac9ebd87498247882d0c874891c0ce9 (diff)
Added GLDrawableFactory.shutdown() to enable clean and cooperative
termination, overriding it in EGLDrawableFactory to call eglTerminate. Made EGLDrawable.setRealized(false) clean up the EGLSurface. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1650 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java4
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawable.java10
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java4
-rw-r--r--src/classes/javax/media/opengl/GLDrawableFactory.java8
4 files changed, 25 insertions, 1 deletions
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 55ed1cc52..17169ebf2 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -223,7 +223,9 @@ public abstract class GLContextImpl extends GLContext {
// GLObjectTracker's ref/unref scheme for the buffer-related
// optimizations), simply clear the cache of known buffers' sizes
// when we destroy contexts
- bufferSizeTracker.clearCachedBufferSizes();
+ if (bufferSizeTracker != null) {
+ bufferSizeTracker.clearCachedBufferSizes();
+ }
// Must hold the lock around the destroy operation to make sure we
// don't destroy the context out from under another thread rendering to it
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index 49dea75ce..abdbd2b7f 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -95,6 +95,16 @@ public class EGLDrawable implements GLDrawable {
if (surface == EGL.EGL_NO_SURFACE) {
throw new GLException("Creation of window surface (eglCreateWindowSurface) failed");
}
+ } else {
+ // Destroy the window surface
+ // FIXME: we should expose a destroy() method on
+ // GLDrawable and get rid of setRealized(), instead
+ // destroying and re-creating the GLDrawable associated
+ // with for example a GLCanvas each time
+ if (!EGL.eglDestroySurface(display, surface)) {
+ throw new GLException("Error destroying window surface (eglDestroySurface)");
+ }
+ surface = EGL.EGL_NO_SURFACE;
}
}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
index 2a8b8fbae..b66d1d33e 100755
--- a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -113,6 +113,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
glesLibraries = libs;
}
+ public void shutdown() {
+ EGL.eglTerminate(display);
+ }
+
public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
GLCapabilitiesChooser chooser,
AbstractGraphicsDevice device) {
diff --git a/src/classes/javax/media/opengl/GLDrawableFactory.java b/src/classes/javax/media/opengl/GLDrawableFactory.java
index 45b3e0dc4..3ed34f86e 100644
--- a/src/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/classes/javax/media/opengl/GLDrawableFactory.java
@@ -173,6 +173,14 @@ public abstract class GLDrawableFactory {
return profile;
}
+ /** Shuts down this GLDrawableFactory, releasing resources
+ associated with it. Before calling this method you should first
+ destroy any GLContexts and GLDrawables that have been created
+ and are still in use. No further OpenGL calls may be made after
+ shutting down the GLDrawableFactory. */
+ public void shutdown() {
+ }
+
/**
* <P> Selects a graphics configuration on the specified graphics
* device compatible with the supplied GLCapabilities. This method