Creating method to determine if OpenGL is GL3 or GLE5

Apr 16, 2014 at 11:03 PM
I am porting some parts of this source file as part of a Java SDK port:

http://jogamp.org/git/?p=jogl.git;a=blob_plain;f=src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java;hb=ba0dc6462a88ee7512a087deaaca760239915548

There is a line in the method called UpdateImage that performs the following checks on the GL instance:

!gl.isGL3() && !gl.isGLES())

When I look the interface definition it says:

/**
  • Indicates whether this GL object conforms to the OpenGL ≥ 3.1 core profile.
  • The GL3 core profile includes the GL2ES2 profile.
  • @see GLContext#isGL3()
    */
    public boolean isGL3();
and

/**
  • Indicates whether this GL object conforms to the OpenGL ES ≥ 2.0 profile.
  • <p>
  • Remark: ES2 compatible desktop profiles are not included.
  • To query whether core ES2 functionality is provided, use {@link #isGLES2Compatible()}.
  • </p>
  • @see #isGLES2Compatible()
  • @see GLContext#isGLES2()
    */
    public boolean isGLES2();
I will like to create an extension method for the OpenGL class to support similar methods.
I am suspecting this information can be retrieved from the version. So starting with this:

public static class OpenGLExtensions
{
    public static bool IsGL3(this OpenGL gl)
    {
        var version = gl.Version;
    }

     public static bool IsGLES(this OpenGL gl)
    {
        var version = gl.Version;
    }
}
Can someone please help?

Thanks.