// JOGL 2 - OpenGL Profiles explained

June 16 2010, updated blogpost: OpenGL 4

JOGL 2 supports several OpenGL Profiles. In this blog entry I try to explain what profiles are and why they are needed.


SGI released the first OpenGL specification 1992. Since this point OpenGL 1.x constantly evolved (under the ARB and later Khronos Group) by adding new functions to the core API. This went well until programmable graphics hardware became mainstream and shaders became suddenly more flexible and efficient as the generic fixed function pipeline.

OpenGL 2.x was the last version in which you could freely mix the fixed function pipeline with the programmable pipeline (as a core feature).

With the release of OpenGL 3.0 the whole fixed function pipeline has been deprecated but you could still use it if you haven't requested a forward compatible context.

OpenGL 3.1 and 3.2 removed most deprecated functionality from core specification, however some implementations (e.g. Nvidia drivers) still allow to get them back via an optional compatibility extension. Since 3.1 was the first release which broke compatibility, it is often seen as major OpenGL 3 release.

JOGL 2 (JSR 231)

JOGL 1.1.1 lived in the timeframe up to OpenGL 3.0 which made it easy to stay in sync with the spec. To be able to solve the issue with the deprecation of functionality, JOGL 2 (JSR maintenance release) introduces an abstraction of the original OpenGL versioning called Profile. Profiles allow Java applications to be written in a way which allows compatibility with multiple OpenGL versions at the same time. Since OpenGL ES (GL for embedded systems) has overlapping functionality with OpenGL itself it opened the opportunity to add even Profiles which bridge desktop and embedded implementations. The class diagram below shows the dependencies between all available Profiles.

Before you start writing a JOGL application you will have to decide first which GLProfile you want to use. The code snippet below lists all currently supported profiles (extracted from GLProfile).

Current list of supported profiles and their mapping to the implementation versions

    /** The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.
bc stands for backward compatibility. */ public static final String GL4bc = "GL4bc"; /** The desktop OpenGL core profile 4.x, with x >= 0 */ public static final String GL4 = "GL4"; /** The desktop OpenGL compatibility profile 3.x, with x >= 1, ie GL2 plus GL3.
bc stands for backward compatibility. */ public static final String GL3bc = "GL3bc"; /** The desktop OpenGL core profile 3.x, with x >= 1 */ public static final String GL3 = "GL3"; /** The desktop OpenGL profile 1.x up to 3.0 */ public static final String GL2 = "GL2"; /** The embedded OpenGL profile ES 1.x, with x >= 0 */ public static final String GLES1 = "GLES1"; /** The embedded OpenGL profile ES 2.x, with x >= 0 */ public static final String GLES2 = "GLES2"; /** The intersection of the desktop GL2 and embedded ES1 profile */ public static final String GL2ES1 = "GL2ES1"; /** The intersection of the desktop GL3, GL2 and embedded ES2 profile */ public static final String GL2ES2 = "GL2ES2"; /** The intersection of the desktop GL3 and GL2 profile */ public static final String GL2GL3 = "GL2GL3";

Note: GL2 Profile supports OpenGL up to version 3.0 (included) - this is not a bug: OpenGL 3.1 was the big game changer

The next two code snippets show the basic steps how to set up OpenGL with JOGL 2.

Context creation

        //create a profile, in this case OpenGL 3.1 or later
        GLProfile profile = GLProfile.get(GLProfile.GL3);
        //configure context
        GLCapabilities capabilities = new GLCapabilities(profile);
        capabilities.setNumSamples(2); // enable anti aliasing - just as a example
        //initialize a GLDrawable of your choice
        GLCanvas canvas = new GLCanvas(capabilities);

        //register GLEventListener
        //... (start rendering thread -> start rendering...)


    public void display(GLAutoDrawable drawable) {
        GL3 gl = drawable.getGL().getGL3();
        //.. render something


Profiles make JOGL 2 very flexible and allow it to build modular and portable applications. For instance part A of an application can be written against the GL2ES2 interface and part B (which is more hardware specific) against the GL3 interface. This would in theory allow to reuse A in an embedded application and B could e.g. disable itself on old desktop hardware which runs only OpenGL 2.x or fall back to a GL2 implementation.

More information can be found on JogAmp.org (direct link to javadoc)

The next release of the OpenGL Pack for NetBeans will fully support JOGL 2. Beta builds can be found here (builds contain JOGL2 beta5):


Thank you SO much for this I've been looking all over for this!

Posted by Dylan Floyd on August 31, 2009 at 06:25 AM CEST #

Yeah thanks a lot :)
really bad documentation on JOGL 2.* since it's so new

Posted by Patrick on September 30, 2009 at 05:12 AM CEST #

I too have thought the JOGL2 kenai wiki is terrible and does not explain this nearly as well as you have. So, when do you think the OpenGL Pack will be ready for final release and any thoughts about getting your plugins verified for NB 6.8?

Posted by adam on January 12, 2010 at 12:51 AM CET #

hi adam,
the problem is: JOGL2 has not been released yet. Thats the main reason why there is no stable NBGL Pack release using JOGL2.

But there is a beta build available:

JOGL2 is now used internally and all sample project have been ported to JOGL2 + NEHE tutorials are now included

feedback is very appreciated

Posted by michael bien on January 12, 2010 at 04:42 PM CET #

Thank you :)
This article is really concise and helpful.

Posted by rhdxmr on January 19, 2010 at 06:24 PM CET #

Hello guys,

Is there any ETA for jogl 2 ? I am looking forward to see it for my new projects.


Posted by Sylvester on July 09, 2010 at 01:35 PM CEST #

sorry no ETA but stabilization will hopefully begin in the next few weeks. Just watch the forums on jogamp.org.

Posted by mbien on July 09, 2010 at 03:52 PM CEST #

Now we see that JOGL support GL3 and GL4, but JOGL2 not yet released and already based on NB 6.7, still now JOGL2 on beta 5 and for NB 6.7, the question: is there any planning for a final release of JOGL2 or JOGL4 (with openGL4) + support for NetBeans 6.9?

Posted by Naoufel on August 02, 2010 at 05:08 PM CEST #

Hi, i am new in openGL , i am runnig import java programs and i am unable to run inport javax.media.opengl.GL2; this type of programs .

and plese tell me on how many jar files will be add in class path and my error is

G:\kasi\FUNCTIONS\OpenGL>java HelloWorld
Exception in thread "main" java.lang.ExceptionInInitializerError
at HelloWorld.main(HelloWorld.java:20)
Caused by: javax.media.opengl.GLException: No profile available: [GL2, GL2ES2, G
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:750)
... 1 more

this error come to me please help me

Posted by kasi on March 28, 2011 at 04:19 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed