Login  Register

GL4 not working in JOGL macbook pro

Posted by Felipe on Sep 05, 2019; 4:55am
URL: https://forum.jogamp.org/GL4-not-working-in-JOGL-macbook-pro-tp4040031.html

I'm running the following code in a 2015 13'' macbook pro:

        public void display(GLAutoDrawable drawable) {
                try
                {
                        GL4 gl=(GL4)GLContext.getCurrentGL();
                       
                        String glVersion=gl.glGetString(GL_VERSION)  ;
                        System.out.println("glVersion="+glVersion);
                       
                        float bkg[] = { 0f, .5f, 0f, 0f };
                        FloatBuffer bkgBuffer = Buffers.newDirectFloatBuffer(bkg);
                        gl.glClearBufferfv(GL_COLOR, 0, bkgBuffer);
                        checkGLError(gl);
               
                }catch(Throwable th)
                {
                        Log.printCaughtExceptionMsg(th);
                        throw new Error(th);
                }
        }

The result for the line System.out.println("glVersion="+glVersion);
is:

glVersion=2.1 INTEL-12.8.38

My question is how can I force the glVersion to be 4.0 instead of 2.1?
I know I have to force JOGL to use the core profile but I do not know how.
Your help is greatly appreciated.