Login  Register

Selecting the highest possible GL profile at runtime.

Posted by Martin on Sep 22, 2021; 10:03am
URL: https://forum.jogamp.org/Selecting-the-highest-possible-GL-profile-at-runtime-tp4041302.html

Hi,

I usually work with GLProfile.get(GLProfile.GL2) but now I want to get the highest possible profile with GLProfile.getMaximum(true).

Most of my code base is made for GL2, so I often invoke gl.getGL2().glSomething(...). I understood that getGL2() will return either a GL2, GL3bc or GL4bc instance depending on the selected profile, and that all three can execute OpenGL method that refer to OpenGL version 1 or 2.

However, when I call gl.getGL2().glSomething(...) with GLProfile.getMaximum(true) that returns a GL4bcImpl on my mac :

Caused by: com.jogamp.opengl.GLException: Not a GL2 implementation
        at jogamp.opengl.gl4.GL4bcImpl.getGL2(GL4bcImpl.java:40488

Did I misunderstood the version mecanism?

I use MacOS 10.12.6 and JOGL 2.3.2

Thanks