diff options
Diffstat (limited to 'src')
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 |