diff options
author | Sven Gothel <[email protected]> | 2013-12-21 22:03:47 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-12-21 22:03:47 +0100 |
commit | 3d0ab3e6263dfdbb9dd0014443ad28b1c9b0c238 (patch) | |
tree | 6fc44cf4616767fe255a61cc701dc6ef0242cf52 /src/jogl/classes/jogamp/opengl | |
parent | ddd5eb35b83ca85dbf43039e8199a7ecf011cdd8 (diff) |
Bug 929 - Reflect ES3 Compatibility with ES2
- Map ES2 -> ES3 GLProfile, if available
- EGLDrawableFactory: Don't query ES2 if ES3 is available
- Fix queries and get methods (GL, GLContext and GLProfile):
- glES3.isGLES2()==true and glES3.getGLES2()!=null
- ctxES3.isGLES2()==true,
- glES3Profile.isGLES2()==true
- Enhance Unit test: TestGLProfile01NEWT
- Test all GLProfile availability combinations
based on implementing GLProfile
- Test all GLProfile's isGL*()
based on highest GLProfile identity
- Test all GL's isGL*()
based on highest GL identity.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
3 files changed, 22 insertions, 24 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 967b88358..f89ded4f6 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -319,27 +319,23 @@ public class EGLContext extends GLContextImpl { } mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); } - /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, final int major) { - int ctp = GLContext.CTX_PROFILE_ES; - if( major >= 3 ) { - ctp |= GLContext.CTX_IMPL_ES3_COMPAT | GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ; - } else if( major >= 2 ) { - ctp |= GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_FBO ; - } - mapStaticGLVersion(device, major, 0, ctp); - } /* pp */ static void mapStaticGLVersion(AbstractGraphicsDevice device, int major, int minor, int ctp) { if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { - // ES1 or ES2 - final int reqMajor = major; - final int reqProfile = GLContext.CTX_PROFILE_ES; - GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp); - if(! ( device instanceof EGLGraphicsDevice ) ) { - final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); - GLContext.mapAvailableGLVersion(eglDevice, reqMajor, reqProfile, major, minor, ctp); + // ES1, ES2, ES3, .. + mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp); + if( 3 == major ) { + // map ES2 -> ES3 + mapStaticGLVersion(device, 2 /* reqMajor */, major, minor, ctp); } } } + private static void mapStaticGLVersion(AbstractGraphicsDevice device, int reqMajor, int major, int minor, int ctp) { + GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); + if(! ( device instanceof EGLGraphicsDevice ) ) { + final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); + GLContext.mapAvailableGLVersion(eglDevice, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); + } + } protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { return GLContext.getGLVersion(major, minor, ctp, gl_version); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index 3c8531730..1ff16fff8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -624,13 +624,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { // ES3 Query final int[] esProfile = { 3 }; madeCurrentES3 = mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) && 3 == esProfile[0]; - // ES2 Query, may result in ES3 - esProfile[0] = 2; - if( mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) ) { - switch( esProfile[0] ) { - case 2: madeCurrentES2 = true; break; - case 3: madeCurrentES3 = true; break; - default: throw new InternalError("XXXX Got "+esProfile[0]); + if( !madeCurrentES3 ) { + // ES2 Query, may result in ES3 + esProfile[0] = 2; + if( mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) ) { + switch( esProfile[0] ) { + case 2: madeCurrentES2 = true; break; + case 3: madeCurrentES3 = true; break; + default: throw new InternalError("XXXX Got "+esProfile[0]); + } } } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 0d231b89d..259c70641 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -291,7 +291,7 @@ public class MacOSXCGLContext extends GLContextImpl final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); final GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final GLProfile glp = capabilitiesChosen.getGLProfile(); - if( glp.isGLES1() || glp.isGLES2() || glp.isGLES3() || + if( glp.isGLES() || ( glp.isGL3() && !isLionOrLater ) || ( glp.isGL4() && !isMavericksOrLater ) ) { throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp); } |