summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx
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/macosx
parent2c0a0981f7e1376064abd981c79c65c9d1b57410 (diff)
GLDrawableFactory: Implementations lifecycle is handled via constructor/destroy()
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java77
1 files changed, 44 insertions, 33 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index ed7959ae8..4543424a6 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -72,43 +72,58 @@ import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.ReflectionUtil;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
- private static final DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper;
-
- static {
- DesktopGLDynamicLookupHelper tmp = null;
- try {
- tmp = new DesktopGLDynamicLookupHelper(new MacOSXCGLDynamicLibraryBundleInfo());
- } catch (GLException gle) {
- if(DEBUG) {
- gle.printStackTrace();
- }
+ public MacOSXCGLDrawableFactory() {
+ super();
+
+ DesktopGLDynamicLookupHelper tmp = null;
+ try {
+ tmp = new DesktopGLDynamicLookupHelper(new MacOSXCGLDynamicLibraryBundleInfo());
+ } catch (GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
}
- macOSXCGLDynamicLookupHelper = tmp;
+ }
+ macOSXCGLDynamicLookupHelper = tmp;
+
+ if(null!=macOSXCGLDynamicLookupHelper) {
/** FIXME ??
- if(null!=macOSXCGLDynamicLookupHelper) {
- CGL.getCGLProcAddressTable().reset(macOSXCGLDynamicLookupHelper);
- } */
+ CGL.getCGLProcAddressTable().reset(macOSXCGLDynamicLookupHelper);
+ */
+
+ // Register our GraphicsConfigurationFactory implementations
+ // The act of constructing them causes them to be registered
+ MacOSXCGLGraphicsConfigurationFactory.registerFactory();
+ if(GLProfile.isAWTAvailable()) {
+ try {
+ ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
+ "registerFactory", null, null, getClass().getClassLoader());
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
+ }
+
+ defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
+ sharedMap = new HashMap<String, SharedResource>();
+ }
+ }
+
+ protected final void destroy() {
+ if(null != sharedMap) {
+ sharedMap.clear();
+ sharedMap = null;
+ }
+ defaultDevice = null;
+ if(null != macOSXCGLDynamicLookupHelper) {
+ macOSXCGLDynamicLookupHelper.destroy();
+ macOSXCGLDynamicLookupHelper = null;
+ }
}
public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
return macOSXCGLDynamicLookupHelper;
}
- public MacOSXCGLDrawableFactory() {
- super();
-
- // Register our GraphicsConfigurationFactory implementations
- // The act of constructing them causes them to be registered
- MacOSXCGLGraphicsConfigurationFactory.registerFactory();
- if(GLProfile.isAWTAvailable()) {
- try {
- ReflectionUtil.callStaticMethod("jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
- "registerFactory", null, null, getClass().getClassLoader());
- } catch (JogampRuntimeException jre) { /* n/a .. */ }
- }
-
- defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
- }
+ private DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper;
+ private HashMap<String, SharedResource> sharedMap = new HashMap<String, SharedResource>();
+ private MacOSXGraphicsDevice defaultDevice;
static class SharedResource {
// private MacOSXCGLDrawable drawable;
@@ -136,8 +151,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean isRECTTextureAvailable() { return hasRECTTextures; }
final boolean isAppletFloatPixelsAvailable() { return hasAppletFloatPixels; }
}
- HashMap<String, SharedResource> sharedMap = new HashMap<String, SharedResource>();
- MacOSXGraphicsDevice defaultDevice;
public final AbstractGraphicsDevice getDefaultDevice() {
return defaultDevice;
@@ -259,8 +272,6 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
- protected final void shutdownInstance() {}
-
protected List<GLCapabilitiesImmutable> getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) {
return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device);
}