diff options
author | Sven Gothel <[email protected]> | 2015-01-23 15:10:20 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-01-23 15:10:20 +0100 |
commit | ec138f2f5c38a677d840e8719292031d91befaa8 (patch) | |
tree | 176ab71efb8fac231bf625f5deb3d7f38129a2fd /src | |
parent | 3471ee732ab1b642a37066c70acbb749eb696d21 (diff) |
Simplify GLDrawable[Impl|Factory].getGLDynamicLookupHelper(..)
- Using GLDrawableFactory.getGLDynamicLookupHelper(String profileName)
- Based on String GLProfile name
- throws GLException if no lookup handler installed (EGL)
- final implementation of GLDrawableImpl.getGLDynamicLookupHelper()
using getGLProfile().getImplName()
Diffstat (limited to 'src')
13 files changed, 26 insertions, 58 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 01e0e8270..a71961122 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -1643,9 +1643,7 @@ public abstract class GLContext { synchronized ( deviceVersionsAvailableSet ) { final String devKey = device.getUniqueID(); if( set ) { - if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) { - throw new InternalError("Already set: "+devKey); - } + deviceVersionsAvailableSet.put(devKey, devKey); } else { deviceVersionsAvailableSet.remove(devKey); } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 7f29bb7dc..9df2a84d6 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -1745,7 +1745,7 @@ public class GLProfile { try { desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GL2); if(null != desktopFactory) { - final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); + final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(GL2); if(null!=glLookupHelper) { hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl; } @@ -1782,8 +1782,8 @@ public class GLProfile { if(null != eglFactory) { hasEGLFactory = true; // update hasGLES1Impl, hasGLES3Impl based on EGL - hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(2) && hasGLES3Impl; - hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(1) && hasGLES1Impl; + hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(GLES2) && hasGLES3Impl; + hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(GLES1) && hasGLES1Impl; } } catch (final LinkageError le) { t=le; @@ -1961,9 +1961,7 @@ public class GLProfile { } } - if(!GLContext.getAvailableGLVersionsSet(device)) { - GLContext.setAvailableGLVersionsSet(device, true); - } + GLContext.setAvailableGLVersionsSet(device, true); if (DEBUG) { System.err.println("GLProfile.initProfilesForDevice: "+device.getConnection()+": added profile(s): desktop "+addedDesktopProfile+", egl "+addedEGLProfile); diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index ee984b74a..5078afd78 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -160,10 +160,11 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** * Returns the GLDynamicLookupHelper - * @param profile if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2, + * @param profileName if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2, * otherwise the profile is ignored. + * @throws GLException if no DynamicLookupHelper is installed */ - public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(int profile); + public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) throws GLException; //--------------------------------------------------------------------------- // Dispatching GLDrawable construction in respect to the NativeSurface Capabilities diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index 7cd887fee..2fb106724 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -69,8 +69,11 @@ public abstract class GLDrawableImpl implements GLDrawable { /** * Returns the DynamicLookupHelper + * @throws GLException if no DynamicLookupHelper is installed */ - public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(); + public final GLDynamicLookupHelper getGLDynamicLookupHelper() throws GLException { + return getFactoryImpl().getGLDynamicLookupHelper( getGLProfile().getImplName() ); + } public final GLDrawableFactoryImpl getFactoryImpl() { return (GLDrawableFactoryImpl) getFactory(); diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 98d1cea71..e23d41498 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -367,11 +367,6 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper() { - return parent.getGLDynamicLookupHelper(); - } - - @Override protected final int getDefaultDrawFramebuffer() { return initialized ? fbos[fboIBack].getWriteFramebuffer() : 0; } @Override diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 5b080a183..4f141fbb1 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -42,7 +42,6 @@ import javax.media.opengl.GLException; import jogamp.nativewindow.ProxySurfaceImpl; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.egl.EGL; @@ -117,19 +116,6 @@ public class EGLDrawable extends GLDrawableImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - if (getGLProfile().usesNativeGLES3()) { - return getFactoryImpl().getGLDynamicLookupHelper(3); - } else if (getGLProfile().usesNativeGLES2()) { - return getFactoryImpl().getGLDynamicLookupHelper(2); - } else if (getGLProfile().usesNativeGLES1()) { - return getFactoryImpl().getGLDynamicLookupHelper(1); - } else { - throw new GLException("Unsupported: "+getGLProfile()); - } - } - - @Override public String toString() { return getClass().getName()+"[realized "+isRealized()+ ",\n\tfactory "+getFactory()+ diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 967bcb6da..55f6248c8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -885,14 +885,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(final int esProfile) { - if ( 2==esProfile || 3==esProfile ) { - return eglES2DynamicLookupHelper; - } else if (1==esProfile) { - return eglES1DynamicLookupHelper; + public GLDynamicLookupHelper getGLDynamicLookupHelper(final String esProfile) { + final GLDynamicLookupHelper res; + if ( GLProfile.GLES2 == esProfile || GLProfile.GLES3 == esProfile ) { + res = eglES2DynamicLookupHelper; + } else if ( GLProfile.GLES1 == esProfile ) { + res = eglES1DynamicLookupHelper; } else { - return eglGLnDynamicLookupHelper; + res = eglGLnDynamicLookupHelper; } + if( null == res ) { + throw new GLException("No lookup for esProfile "+esProfile); + } + return res; } @Override diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java index 8ea84a32d..4a7d41dab 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java @@ -50,7 +50,6 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; public abstract class MacOSXCGLDrawable extends GLDrawableImpl { // The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs @@ -148,11 +147,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } } - @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - return getFactoryImpl().getGLDynamicLookupHelper(0); - } - // Support for "mode switching" as described in MacOSXCGLDrawable public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 6cc696d16..fe054e419 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -146,7 +146,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) { return macOSXCGLDynamicLookupHelper; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java index 00b048e38..68fb9157b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java @@ -49,7 +49,6 @@ import com.jogamp.common.util.PropertyAccess; import jogamp.nativewindow.windows.GDI; import jogamp.opengl.Debug; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; public abstract class WindowsWGLDrawable extends GLDrawableImpl { @@ -105,9 +104,4 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } } } - - @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - return getFactoryImpl().getGLDynamicLookupHelper(0); - } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 8b67cc9ee..a81863cff 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -229,7 +229,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) { return windowsWGLDynamicLookupHelper; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java index c29bc3bc3..d7aec63b5 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java @@ -44,7 +44,6 @@ import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GLDrawableFactory; import jogamp.opengl.GLDrawableImpl; -import jogamp.opengl.GLDynamicLookupHelper; public abstract class X11GLXDrawable extends GLDrawableImpl { protected X11GLXDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { @@ -52,11 +51,6 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper() { - return getFactoryImpl().getGLDynamicLookupHelper(0); - } - - @Override protected void setRealizedImpl() { if(realized) { final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 69d612da1..a054d5385 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -162,7 +162,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { + public final GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) { return x11GLXDynamicLookupHelper; } |