Class GLProfile

java.lang.Object
com.jogamp.opengl.GLProfile

public class GLProfile extends Object
Specifies the the OpenGL profile. This class static singleton initialization queries the availability of all OpenGL Profiles and instantiates singleton GLProfile objects for each available profile. The platform default profile may be used, using GLProfile#GetProfileDefault(), or more specialized versions using the other static GetProfile methods.
  • Field Details

    • DEBUG

      public static final boolean DEBUG
    • disableOpenGLCore

      public static final boolean disableOpenGLCore
      In case no native OpenGL core profiles are required and if one platform may have a buggy implementation, setting the property jogl.disable.openglcore disables querying possible existing native OpenGL core profiles.

      This exclusion is disabled for Platform.OSType.MACOS.

    • disableOpenGLARBContext

      public static final boolean disableOpenGLARBContext
      In case the implementation of the ARB_create_context context creation extension is buggy on one platform, setting the property jogl.disable.openglarbcontext disables utilizing it.

      This exclusion also disables OpenGL ES.

      This exclusion is disabled for Platform.OSType.MACOS.

    • disableOpenGLES

      public static final boolean disableOpenGLES
      In case no OpenGL ES profiles are required and if one platform may have a buggy implementation, setting the property jogl.disable.opengles disables querying possible existing OpenGL ES profiles.
    • disableOpenGLDesktop

      public static final boolean disableOpenGLDesktop
      In case no OpenGL desktop profiles are required and if one platform may have a buggy implementation, setting the property jogl.disable.opengldesktop disables querying possible existing OpenGL desktop profiles.
    • disableSurfacelessContext

      public static final boolean disableSurfacelessContext
      Disable surfaceless OpenGL context capability and its probing by setting the property jogl.disable.surfacelesscontext.

      By default surfaceless OpenGL context capability is probed, i.e. whether an OpenGL context can be made current without a default framebuffer.

      If probing fails or if this property is set, the quirk GLRendererQuirks.NoSurfacelessCtx is being set.

    • enableANGLE

      public static final boolean enableANGLE
      We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome. When run in the mentioned browsers, the eglInitialize(..) implementation crashes.

      This can be overridden by explicitly enabling ANGLE on Windows by setting the property jogl.enable.ANGLE.

    • GL4bc

      public static final String GL4bc
      The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.
      bc stands for backward compatibility.
      See Also:
    • GL4

      public static final String GL4
      The desktop OpenGL core profile 4.x, with x >= 0
      See Also:
    • GL3bc

      public static final String GL3bc
      The desktop OpenGL compatibility profile 3.x, with x >= 1, ie GL2 plus GL3.
      bc stands for backward compatibility.
      See Also:
    • GL3

      public static final String GL3
      The desktop OpenGL core profile 3.x, with x >= 1
      See Also:
    • GL2

      public static final String GL2
      The desktop OpenGL profile 1.x up to 3.0
      See Also:
    • GLES1

      public static final String GLES1
      The embedded OpenGL profile ES 1.x, with x >= 0
      See Also:
    • GLES2

      public static final String GLES2
      The embedded OpenGL profile ES 2.x, with x >= 0
      See Also:
    • GLES3

      public static final String GLES3
      The embedded OpenGL profile ES 3.x, with x >= 0
      See Also:
    • GL2ES1

      public static final String GL2ES1
      The intersection of the desktop GL2 and embedded ES1 profile
      See Also:
    • GL2ES2

      public static final String GL2ES2
      The intersection of the desktop GL3, GL2 and embedded ES2 profile
      See Also:
    • GL2GL3

      public static final String GL2GL3
      The intersection of the desktop GL3 and GL2 profile
      See Also:
    • GL4ES3

      public static final String GL4ES3
      The intersection of the desktop GL4 and ES3 profile, available only if either ES3 or GL4 w/ GL_ARB_ES3_compatibility is available.
      See Also:
    • GL_PROFILE_LIST_ALL

      public static final String[] GL_PROFILE_LIST_ALL
      All GL Profiles in the order of default detection. Desktop compatibility profiles (the one with fixed function pipeline) comes first from highest to lowest version.

      This includes the generic subset profiles GL2GL3, GL2ES2 and GL2ES1.

      • GL4bc
      • GL3bc
      • GL2
      • GL4
      • GL3
      • GLES3
      • GL4ES3
      • GL2GL3
      • GLES2
      • GL2ES2
      • GLES1
      • GL2ES1
    • GL_PROFILE_LIST_MAX

      public static final String[] GL_PROFILE_LIST_MAX
      Order of maximum profiles.
      • GL4bc
      • GL4
      • GL3bc
      • GL3
      • GLES3
      • GL2
      • GLES2
      • GLES1
    • GL_PROFILE_LIST_MIN

      public static final String[] GL_PROFILE_LIST_MIN
      Order of minimum profiles.
      • GLES1
      • GLES2
      • GL2
      • GLES3
      • GL3
      • GL3bc
      • GL4
      • GL4bc
    • GL_PROFILE_LIST_MIN_DESKTOP

      public static final String[] GL_PROFILE_LIST_MIN_DESKTOP
      Order of minimum original desktop profiles.
      • GL2
      • GL3bc
      • GL4bc
      • GL3
      • GL4
    • GL_PROFILE_LIST_MAX_FIXEDFUNC

      public static final String[] GL_PROFILE_LIST_MAX_FIXEDFUNC
      Order of maximum fixed function profiles
      • GL4bc
      • GL3bc
      • GL2
      • GLES1
    • GL_PROFILE_LIST_MAX_PROGSHADER

      public static final String[] GL_PROFILE_LIST_MAX_PROGSHADER
      Order of maximum programmable shader profiles
      • GL4bc
      • GL4
      • GL3bc
      • GL3
      • GLES3
      • GL2
      • GLES2
    • GL_PROFILE_LIST_MAX_PROGSHADER_CORE

      public static final String[] GL_PROFILE_LIST_MAX_PROGSHADER_CORE
      Order of maximum programmable shader core only profiles
      • GL4
      • GL3
      • GLES3
      • GLES2
  • Method Details

    • isInitialized

      public static boolean isInitialized()
      Returns:
      true if JOGL has been initialized, i.e. manually via initSingleton() or implicit, otherwise returns false.
      Since:
      2.2.1
    • initSingleton

      public static void initSingleton()
      Static initialization of JOGL.

      This method shall not need to be called for other reasons than having a defined initialization sequence.

      In case this method is not invoked, GLProfile is initialized implicit by the first call to getDefault(), get(java.lang.String).

      To initialize JOGL at startup ASAP, this method may be invoked in the main class's static initializer block, in the static main() method or in the Applet init() method.

      Since JOGL's initialization is complex and involves multi threading, it is not recommended to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed on the AWT EDT, invoke this method outside the AWT EDT - see above.

    • initProfiles

      public static void initProfiles(AbstractGraphicsDevice device) throws GLException
      Trigger eager initialization of GLProfiles for the given device, in case it isn't done yet.
      Throws:
      GLException - if no profile for the given device is available.
    • shutdown

      public static void shutdown()
      Manual shutdown method, may be called after your last JOGL use within the running JVM.
      It releases all temporary created resources, ie issues GLDrawableFactory.shutdown().
      The shutdown implementation is called via the JVM shutdown hook, if not manually invoked.

      This method shall not need to be called for other reasons than issuing a proper shutdown of resources at a defined time.

    • isAvailable

      public static boolean isAvailable(AbstractGraphicsDevice device, String profile)
      Returns the availability of a profile on a device.
      Parameters:
      device - a valid AbstractGraphicsDevice, or null for the default device.
      profile - a valid GLProfile name (GL4bc, GL4, GL2, ..), or [ null, GL ] for the default profile.
      Returns:
      true if the profile is available for the device, otherwise false.
    • isAvailable

      public static boolean isAvailable(String profile)
      Returns the availability of a profile on the default device.
      Parameters:
      profile - a valid GLProfile name (GL4bc, GL4, GL2, ..), or [ null, GL ] for the default profile.
      Returns:
      true if the profile is available for the default device, otherwise false.
    • isAnyAvailable

      public static boolean isAnyAvailable()
      Returns the availability of any profile on the default device.
      Returns:
      true if any profile is available for the default device, otherwise false.
    • glAvailabilityToString

      public static String glAvailabilityToString(AbstractGraphicsDevice device)
    • glAvailabilityToString

      public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb)
    • glAvailabilityToString

      public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, String indent, int indentCount)
    • glAvailabilityToString

      public static String glAvailabilityToString()
      Uses the default device
    • getDefault

      public static GLProfile getDefault(AbstractGraphicsDevice device)
      Returns a default GLProfile object, reflecting the best for the running platform. It selects the first of the set GL_PROFILE_LIST_ALL and favors hardware acceleration.
      Throws:
      GLException - if no profile is available for the device.
      See Also:
    • getDefault

      public static GLProfile getDefault()
      Returns a default GLProfile object, reflecting the best for the running platform. It selects the first of the set GL_PROFILE_LIST_ALL and favors hardware acceleration.

      Uses the default device.

      Throws:
      GLException - if no profile is available for the default device.
    • getMaximum

      public static GLProfile getMaximum(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) throws GLException
      Returns the highest profile. It selects the first of the set: GL_PROFILE_LIST_MAX
      Throws:
      GLException - if no profile is available for the device.
      See Also:
    • getMaximum

      public static GLProfile getMaximum(boolean favorHardwareRasterizer) throws GLException
      Uses the default device
      Throws:
      GLException - if no profile is available for the default device.
      See Also:
    • getMinimum

      public static GLProfile getMinimum(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) throws GLException
      Returns the lowest profile. It selects the first of the set: GL_PROFILE_LIST_MIN
      Throws:
      GLException - if no desktop profile is available for the device.
      See Also:
    • getMinimum

      public static GLProfile getMinimum(boolean favorHardwareRasterizer) throws GLException
      Uses the default device
      Throws:
      GLException - if no desktop profile is available for the default device.
      See Also:
    • getMaxFixedFunc

      public static GLProfile getMaxFixedFunc(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) throws GLException
      Returns the highest profile, implementing the fixed function pipeline. It selects the first of the set: GL_PROFILE_LIST_MAX_FIXEDFUNC
      Throws:
      GLException - if no fixed function profile is available for the device.
      See Also:
    • getMaxFixedFunc

      public static GLProfile getMaxFixedFunc(boolean favorHardwareRasterizer) throws GLException
      Uses the default device
      Throws:
      GLException - if no fixed function profile is available for the default device.
      See Also:
    • getMaxProgrammable

      public static GLProfile getMaxProgrammable(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) throws GLException
      Returns the highest profile, implementing the programmable shader pipeline. It selects the first of the set: GL_PROFILE_LIST_MAX_PROGSHADER
      Throws:
      GLException - if no programmable profile is available for the device.
      See Also:
    • getMaxProgrammable

      public static GLProfile getMaxProgrammable(boolean favorHardwareRasterizer) throws GLException
      Uses the default device
      Throws:
      GLException - if no programmable profile is available for the default device.
      See Also:
    • getMaxProgrammableCore

      public static GLProfile getMaxProgrammableCore(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) throws GLException
      Returns the highest profile, implementing the programmable shader core pipeline only. It selects the first of the set: GL_PROFILE_LIST_MAX_PROGSHADER_CORE
      Throws:
      GLException - if no programmable core profile is available for the device.
      See Also:
    • getMaxProgrammableCore

      public static GLProfile getMaxProgrammableCore(boolean favorHardwareRasterizer) throws GLException
      Uses the default device
      Throws:
      GLException - if no programmable core profile is available for the default device.
      See Also:
    • getGL2ES1

      public static GLProfile getGL2ES1(AbstractGraphicsDevice device) throws GLException
      Returns the GL2ES1 profile implementation, hence compatible w/ GL2ES1.
      It returns:
         GLProfile.get(device, GLProfile.GL2ES1).getImpl());
       

      Selection favors hardware rasterizer.

      Throws:
      GLException - if no GL2ES1 compatible profile is available for the default device.
      See Also:
    • getGL2ES1

      public static GLProfile getGL2ES1() throws GLException
      Calls getGL2ES1(AbstractGraphicsDevice) using the default device.

      Selection favors hardware rasterizer.

      Throws:
      GLException
      See Also:
    • getGL2ES2

      public static GLProfile getGL2ES2(AbstractGraphicsDevice device) throws GLException
      Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
      It returns:
         GLProfile.get(device, GLProfile.GL2ES2).getImpl());
       

      Selection favors hardware rasterizer.

      Throws:
      GLException - if no GL2ES2 compatible profile is available for the default device.
      See Also:
    • getGL2ES2

      public static GLProfile getGL2ES2() throws GLException
      Calls getGL2ES2(AbstractGraphicsDevice) using the default device.

      Selection favors hardware rasterizer.

      Throws:
      GLException
      See Also:
    • getGL4ES3

      public static GLProfile getGL4ES3(AbstractGraphicsDevice device) throws GLException
      Returns the GL4ES3 profile implementation, hence compatible w/ GL4ES3.
      It returns:
         GLProfile.get(device, GLProfile.GL4ES3).getImpl());
       

      Selection favors hardware rasterizer.

      Throws:
      GLException - if no GL4ES3 compatible profile is available for the default device.
      See Also:
    • getGL4ES3

      public static GLProfile getGL4ES3() throws GLException
      Calls getGL4ES3(AbstractGraphicsDevice) using the default device.

      Selection favors hardware rasterizer.

      Throws:
      GLException
      See Also:
    • getGL2GL3

      public static GLProfile getGL2GL3(AbstractGraphicsDevice device) throws GLException
      Returns the GL2GL3 profile implementation, hence compatible w/ GL2GL3.
      It returns:
         GLProfile.get(device, GLProfile.GL2GL3).getImpl());
       

      Selection favors hardware rasterizer.

      Throws:
      GLException - if no GL2GL3 compatible profile is available for the default device.
      See Also:
    • getGL2GL3

      public static GLProfile getGL2GL3() throws GLException
      Calls getGL2GL3(AbstractGraphicsDevice) using the default device.

      Selection favors hardware rasterizer.

      Throws:
      GLException
      See Also:
    • get

      public static GLProfile get(AbstractGraphicsDevice device, String profile) throws GLException
      Returns a GLProfile object. verifies the given profile and chooses an appropriate implementation. A generic value of null or GL will result in the default profile.
      Parameters:
      device - a valid AbstractGraphicsDevice, or null for the default device.
      profile - a valid GLProfile name (GL4bc, GL4, GL2, ..), or [ null, GL ] for the default profile.
      Throws:
      GLException - if the requested profile is not available for the device.
    • get

      public static GLProfile get(String profile) throws GLException
      Uses the default device
      Parameters:
      profile - a valid GLProfile name (GL4bc, GL4, GL2, ..), or [ null, GL ] for the default profile.
      Throws:
      GLException - if the requested profile is not available for the default device.
    • get

      public static GLProfile get(AbstractGraphicsDevice device, String[] profiles, boolean favorHardwareRasterizer) throws GLException
      Returns the first profile from the given list, where an implementation is available.
      Parameters:
      device - a valid AbstractGraphicsDevice, or null for the default device.
      profiles - array of valid GLProfile name (GL4bc, GL4, GL2, ..)
      favorHardwareRasterizer - set to true, if hardware rasterizer shall be favored, otherwise false.
      Throws:
      GLException - if the non of the requested profiles is available for the device.
    • get

      public static GLProfile get(String[] profiles, boolean favorHardwareRasterizer) throws GLException
      Uses the default device
      Parameters:
      profiles - array of valid GLProfile name (GL4bc, GL4, GL2, ..)
      favorHardwareRasterizer - set to true, if hardware rasterizer shall be favored, otherwise false.
      Throws:
      GLException - if the non of the requested profiles is available for the default device.
    • usesNativeGLES1

      public static boolean usesNativeGLES1(String profileImpl)
      Indicates whether the native OpenGL ES1 profile is in use. This requires an EGL interface.
    • usesNativeGLES2

      public static boolean usesNativeGLES2(String profileImpl)
      Indicates whether the native OpenGL ES3 or ES2 profile is in use. This requires an EGL, ES3 or ES2 compatible interface.
    • usesNativeGLES3

      public static boolean usesNativeGLES3(String profileImpl)
      Indicates whether the native OpenGL ES2 profile is in use. This requires an EGL, ES3 compatible interface.
    • usesNativeGLES

      public static boolean usesNativeGLES(String profileImpl)
      Indicates whether either of the native OpenGL ES profiles are in use.
    • isAWTAvailable

      public static boolean isAWTAvailable()
      Returns:
      NativeWindowFactory.isAWTAvailable() and JOGL's AWT part
    • getGLTypeName

      public static String getGLTypeName(int type)
    • getGLArrayName

      public static String getGLArrayName(int array)
    • getGLImplBaseClassName

      public final String getGLImplBaseClassName()
    • getGLCtor

      public final Constructor<?> getGLCtor(boolean glObject)
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
      Parameters:
      o - GLProfile object to compare with
      Returns:
      true if given Object is a GLProfile and if both, profile and profileImpl is equal with this.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • verifyEquality

      public final void verifyEquality(GLProfile glp) throws GLException
      Parameters:
      glp - GLProfile to compare with
      Throws:
      GLException - if given GLProfile and this aren't equal
    • getName

      public final String getName()
      return this profiles name
    • getImpl

      public final GLProfile getImpl()
      return this profiles implementation, eg. GL2ES2 -> GL2, or GL3 -> GL3
    • isHardwareRasterizer

      public final boolean isHardwareRasterizer()
      return true if impl. is a hardware rasterizer, otherwise false.
    • getImplName

      public final String getImplName()
      return this profiles implementation name, eg. GL2ES2 -> GL2, or GL3 -> GL3
    • isGL4bc

      public final boolean isGL4bc()
      Indicates whether this profile is capable of GL4bc.

      Includes [ GL4bc ].

    • isGL4

      public final boolean isGL4()
      Indicates whether this profile is capable of GL4.

      Includes [ GL4bc, GL4 ].

    • isGL3bc

      public final boolean isGL3bc()
      Indicates whether this profile is capable of GL3bc.

      Includes [ GL4bc, GL3bc ].

    • isGL3

      public final boolean isGL3()
      Indicates whether this profile is capable of GL3.

      Includes [ GL4bc, GL4, GL3bc, GL3 ].

    • isGL2

      public final boolean isGL2()
      Indicates whether this profile is capable of GL2 .

      Includes [ GL4bc, GL3bc, GL2 ].

    • isGLES1

      public final boolean isGLES1()
      Indicates whether this profile is capable of GLES1.

      Includes [ GLES1 ].

    • isGLES2

      public final boolean isGLES2()
      Indicates whether this profile is capable of GLES2.

      Includes [ GLES2, GLES3 ].

    • isGLES3

      public final boolean isGLES3()
      Indicates whether this profile is capable of GLES3.

      Includes [ GLES3 ].

    • isGLES

      public final boolean isGLES()
      Indicates whether this profile is capable of GLES.

      Includes [ GLES1, GLES2, GLES3 ].

    • isGL2ES1

      public final boolean isGL2ES1()
      Indicates whether this profile is capable of GL2ES1.

      Includes [ GL4bc, GL3bc, GL2, GLES1, GL2ES1 ].

    • isGL2GL3

      public final boolean isGL2GL3()
      Indicates whether this profile is capable of GL2GL3.

      Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3 ].

    • isGL2ES2

      public final boolean isGL2ES2()
      Indicates whether this profile is capable of GL2ES2.

      Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GL2GL3, GL2ES2, GLES2 ].

    • isGL2ES3

      public final boolean isGL2ES3()
      Indicates whether this profile is capable of GL2ES3.

      Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL3ES3, GL2, GL2GL3 ].

      See Also:
    • isGL3ES3

      public final boolean isGL3ES3()
      Indicates whether this profile is capable of GL3ES3.

      Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].

    • isGL4ES3

      public final boolean isGL4ES3()
      Indicates whether this profile is capable of GL4ES3.

      Includes [ GL4bc, GL4, GLES3 ].

    • hasGLSL

      public final boolean hasGLSL()
      Indicates whether this profile supports GLSL, i.e. isGL2ES2().
    • usesNativeGLES1

      public final boolean usesNativeGLES1()
      Indicates whether this profile uses the native OpenGL ES1 implementations.
    • usesNativeGLES2

      public final boolean usesNativeGLES2()
      Indicates whether this profile uses the native OpenGL ES2 implementations.
    • usesNativeGLES3

      public final boolean usesNativeGLES3()
      Indicates whether this profile uses the native OpenGL ES3 implementations.
    • usesNativeGLES

      public final boolean usesNativeGLES()
      Indicates whether this profile uses either of the native OpenGL ES implementations.
    • isValidDataType

      public boolean isValidDataType(int type, boolean throwException)
      General validation if type is a valid GL data type for the current profile
    • isValidArrayDataType

      public boolean isValidArrayDataType(int index, int comps, int type, boolean isVertexAttribPointer, boolean throwException)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDefaultDevice

      public static AbstractGraphicsDevice getDefaultDevice()
    • createCustomGLProfile

      public static GLProfile createCustomGLProfile(String profile, GLProfile profileImpl)