aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/egl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-12-01 16:48:45 +0100
committerSven Gothel <[email protected]>2011-12-01 16:48:45 +0100
commit53ba4a2b3639a3746218693ea588159e5c6d07c7 (patch)
tree366dfa15bf1ddc23181d4e00eedf701a260dc092 /src/jogl/classes/jogamp/opengl/egl
parent2c0a0981f7e1376064abd981c79c65c9d1b57410 (diff)
GLDrawableFactory: Implementations lifecycle is handled via constructor/destroy()
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java37
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);
}