diff options
author | Sven Gothel <[email protected]> | 2015-08-30 06:26:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-30 06:26:29 +0200 |
commit | 5acb70d3d301fe66e4d03037325a91528e4c2c1d (patch) | |
tree | 971c01c0a098b1ad12ea2ac6fecbf3b422ee486c /src/jogl/classes/jogamp/opengl/x11 | |
parent | 18e487fdfe6f27564d976aa3a568d0ddc272d8ba (diff) |
Bug 1203: Add missing constraints in desktop *GLContext.create* methods: Bail out if GL ES is requested ; Fix test case
*GLContext.createImpl(..) shall throw an GLException:
*GLContext.createContextARBImpl(..) shall return 0:
- Desktop implementation: if GL ES is requested
- EGL implementation: if GL Desktop is requested, but not available
Otherwise GLContextImpl may mistake a desktop context for an ES one.
+++
Fix unit test TestGLAutoDrawableFactoryGLProfileDeviceNEWT.test11ES2OnDesktop():
We have to query the factory by desired profile,
since the desktop factory cannot produce an GL ES context.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 79768d662..9af534f35 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -229,6 +229,16 @@ public class X11GLXContext extends GLContextImpl { System.err.println(getThreadName()+": X11GLXContext.createContextARBImpl: "+getGLVersion(major, minor, ctp, "@creation") + ", handle "+toHexString(drawable.getHandle()) + ", share "+toHexString(share)+", direct "+direct); } + final boolean ctDesktopGL = 0 == ( CTX_PROFILE_ES & ctp ); + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + if( !ctDesktopGL ) { + if(DEBUG) { + System.err.println(getThreadName() + ": X11GLXContext.createContextARBImpl: GL ES not avail "+getGLVersion(major, minor, ctp, "@creation")); + } + return 0; // n/a + } final GLDynamicLookupHelper dlh = getGLDynamicLookupHelper(major, ctp); if( null == dlh ) { if(DEBUG) { @@ -244,10 +254,6 @@ public class X11GLXContext extends GLContextImpl { ", glXCreateContextAttribsARB: "+toHexString(glXExtProcAddressTable._addressof_glXCreateContextAttribsARB)); } - final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; - final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; - final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); attribs.put(ctx_arb_attribs_idx_major + 1, major); attribs.put(ctx_arb_attribs_idx_minor + 1, minor); @@ -334,6 +340,10 @@ public class X11GLXContext extends GLContextImpl { "], fbCfg "+config.hasFBConfig()+" -> "+createContextARBAvailable+ "], shared "+sharedCreatedWithARB+"]"); } + if( glp.isGLES() ) { + throw new GLException(getThreadName()+": Unable to create OpenGL ES context on desktopDevice "+device+ + ", config "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)); + } if( !config.hasFBConfig() ) { // not able to use FBConfig -> GLX 1.1 |