gl.getGL2() throws a "Not a GL2 implementation" when gl instance is GL4bcImpl. GL4bc being backward compatible, it is supposed to be able to return a GL2 instance.
Context
Fail on : Mac OS 10.12 + Intel CPU + NVidia GPU + JDK 8
Fail on : Mac OS 11.4 + Silicon Chip + JDK 8
Success on : Ubuntu 20.04 + Intel CPU + Intel GPU + JDK 8
Reproduce
See below a test program to reproduce the issue which can be summarized as follow :
GL instance is GL4bcImpl, which is what we expect.
drawable.getContext().isGLCompatibilityProfile(); returns false, which shouldn't be as we explicitely disabled core open GL to get a compatibility profile.
gl.getGL2() throws a "Not a GL2 implementation"
Investigation
gl.getGL2() relies on GLContext.isGL2()
public final boolean isGL2() {
return 0 != ( ctxOptions & CTX_PROFILE_COMPAT ) && ctxVersion.getMajor()>=1 ;
}
with ctxOptions : 0x4C45 (which is ...0101)
and CTX_PROFILE_COMPAT : 0x2 (which is 10)
so I presume the problem comes from this ctxOptions value. I could not locate exactly where it is set, seamingly somewhere around GLContextImpl.createContextARB
The complete GLContext for macOS BigSur + Silicon is produced by the program given at the end of this ticket
Discussed in a JOGL forum while trying to get the highest available OpenGL profile.
Problem
gl.getGL2()
throws a "Not a GL2 implementation" when gl instance isGL4bcImpl
.GL4bc
being backward compatible, it is supposed to be able to return aGL2
instance.Context
Reproduce
See below a test program to reproduce the issue which can be summarized as follow :
When using :
GLProfile glp = GLProfile.getMaxProgrammable(true);
-Djogl.disable.openglcore=true
Then :
GL
instance isGL4bcImpl
, which is what we expect.drawable.getContext().isGLCompatibilityProfile();
returnsfalse
, which shouldn't be as we explicitely disabled core open GL to get a compatibility profile.gl.getGL2()
throws a "Not a GL2 implementation"Investigation
gl.getGL2()
relies onGLContext.isGL2()
so I presume the problem comes from this
ctxOptions
value. I could not locate exactly where it is set, seamingly somewhere aroundGLContextImpl.createContextARB
The complete
GLContext
for macOS BigSur + Silicon is produced by the program given at the end of this ticketThe complete program to reproduce the issue