diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 4a1a4ccf5..fe4adb564 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -50,10 +50,9 @@ import java.util.HashMap; import java.util.List; public class EGLDrawableFactory extends GLDrawableFactoryImpl { - private static final GLDynamicLookupHelper eglES1DynamicLookupHelper; - private static final GLDynamicLookupHelper eglES2DynamicLookupHelper; - - static { + public EGLDrawableFactory() { + super(); + // Register our GraphicsConfigurationFactory implementations // The act of constructing them causes them to be registered EGLGraphicsConfigurationFactory.registerFactory(); @@ -94,13 +93,33 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(null!=eglES2DynamicLookupHelper && eglES2DynamicLookupHelper.isLibComplete()) { EGL.resetProcAddressTable(eglES2DynamicLookupHelper); } + if(null != eglES1DynamicLookupHelper || null != eglES2DynamicLookupHelper) { + defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + sharedMap = new HashMap(); + } } - public EGLDrawableFactory() { - super(); - defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT); + protected final void destroy() { + if(null != sharedMap) { + sharedMap.clear(); + sharedMap = null; + } + defaultDevice = null; + if(null != eglES1DynamicLookupHelper) { + eglES1DynamicLookupHelper.destroy(); + eglES1DynamicLookupHelper = null; + } + if(null != eglES2DynamicLookupHelper) { + eglES2DynamicLookupHelper.destroy(); + eglES2DynamicLookupHelper = null; + } } + private GLDynamicLookupHelper eglES1DynamicLookupHelper; + private GLDynamicLookupHelper eglES2DynamicLookupHelper; + private HashMap/*<connection, SharedResource>*/ sharedMap; + private EGLGraphicsDevice defaultDevice; + static class SharedResource { private EGLGraphicsDevice device; // private EGLDrawable drawable; @@ -125,8 +144,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final boolean wasES1ContextAvailable() { return wasES1ContextCreated; } final boolean wasES2ContextAvailable() { return wasES2ContextCreated; } } - HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap(); - EGLGraphicsDevice defaultDevice; public final AbstractGraphicsDevice getDefaultDevice() { return defaultDevice; @@ -243,8 +260,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - protected final void shutdownInstance() {} - protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { return EGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } |