javax.media.opengl
Class GLProfile

java.lang.Object
  extended by javax.media.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 Summary
static boolean DEBUG
           
static String[] GL_PROFILE_LIST_ALL
          All GL Profiles in the order of default detection.
static String[] GL_PROFILE_LIST_GL2ES1
          All GL2ES1 Profiles in the order of default detection.
static String[] GL_PROFILE_LIST_GL2ES2
          All GL2ES2 Profiles in the order of default detection.
static String[] GL_PROFILE_LIST_GLES
          All GLES Profiles in the order of default detection.
static String[] GL_PROFILE_LIST_MAX
          Order of maximum profiles.
static String[] GL_PROFILE_LIST_MAX_FIXEDFUNC
          Order of maximum fixed function profiles GL4bc GL3bc GL2 GLES1
static String[] GL_PROFILE_LIST_MAX_PROGSHADER
          Order of maximum programmable shader profiles GL4bc GL4 GL3bc GL3 GL2 GLES2
static String[] GL_PROFILE_LIST_MIN
          Order of minimum profiles.
static String[] GL_PROFILE_LIST_MIN_DESKTOP
          Order of minimum original desktop profiles.
static String GL2
          The desktop OpenGL profile 1.x up to 3.0
static String GL2ES1
          The intersection of the desktop GL2 and embedded ES1 profile
static String GL2ES2
          The intersection of the desktop GL3, GL2 and embedded ES2 profile
static String GL2GL3
          The intersection of the desktop GL3 and GL2 profile
static String GL3
          The desktop OpenGL core profile 3.x, with x >= 1
static String GL3bc
          The desktop OpenGL compatibility profile 3.x, with x >= 1, ie GL2 plus GL3.
bc stands for backward compatibility.
static String GL4
          The desktop OpenGL core profile 4.x, with x >= 0
static String GL4bc
          The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.
bc stands for backward compatibility.
static String GLES1
          The embedded OpenGL profile ES 1.x, with x >= 0
static String GLES2
          The embedded OpenGL profile ES 2.x, with x >= 0
 
Method Summary
 boolean equals(Object o)
           
static GLProfile get(AbstractGraphicsDevice device, String profile)
          Returns a GLProfile object.
static GLProfile get(AbstractGraphicsDevice device, String[] profiles)
          Returns the first profile from the given list, where an implementation is available.
static GLProfile get(String profile)
          Uses the default device
static GLProfile get(String[] profiles)
          Uses the default device
static GLProfile getDefault()
          Uses the default device
static GLProfile getDefault(AbstractGraphicsDevice device)
          Returns a default GLProfile object, reflecting the best for the running platform.
static AbstractGraphicsDevice getDefaultDesktopDevice()
           
static AbstractGraphicsDevice getDefaultDevice()
           
static AbstractGraphicsDevice getDefaultEGLDevice()
           
static GLProfile getGL2ES1()
          Returns an available GL2ES1 compatible profile.
static GLProfile getGL2ES1(AbstractGraphicsDevice device)
          Returns an available GL2ES1 compatible profile.
static GLProfile getGL2ES2()
          Returns an available GL2ES2 compatible profile It returns the first available of the set: GL_PROFILE_LIST_GL2ES2.
static GLProfile getGL2ES2(AbstractGraphicsDevice device)
          Returns an available GL2ES2 compatible profile.
static String getGLArrayName(int array)
           
 String getGLImplBaseClassName()
           
static String getGLTypeName(int type)
           
 String getImplName()
           
static GLProfile getMaxFixedFunc()
          Uses the default device
static GLProfile getMaxFixedFunc(AbstractGraphicsDevice device)
          Returns the highest profile, implementing the fixed function pipeline.
static GLProfile getMaximum()
          Uses the default device
static GLProfile getMaximum(AbstractGraphicsDevice device)
          Returns the highest profile.
static GLProfile getMaxProgrammable()
          Uses the default device
static GLProfile getMaxProgrammable(AbstractGraphicsDevice device)
          Returns the highest profile, implementing the programmable shader pipeline.
static GLProfile getMinimum()
          Uses the default device
static GLProfile getMinimum(AbstractGraphicsDevice device)
          Returns the lowest profile.
 String getName()
           
static String glAvailabilityToString()
          Uses the default device
static String glAvailabilityToString(AbstractGraphicsDevice device)
           
 boolean hasGLSL()
          Indicates whether this profile supports GLSL.
 int hashCode()
           
static void initProfiles(AbstractGraphicsDevice device)
          Trigger eager initialization of GLProfiles for the given device, in case it isn't done yet.
static void initSingleton(boolean firstUIActionOnProcess)
          Static one time initialization of JOGL.
static boolean isAnyAvailable()
          Returns the availability of any profile on the default device.
static boolean isAvailable(AbstractGraphicsDevice device, String profile)
          Returns the availability of a profile on a device.
static boolean isAvailable(String profile)
          Returns the availability of a profile on the default device.
static boolean isAWTAvailable()
           
 boolean isGL2()
          Indicates whether this context is a GL2 context
 boolean isGL2ES1()
          Indicates whether this profile is capable of GL2ES1.
 boolean isGL2ES2()
          Indicates whether this profile is capable os GL2ES2.
 boolean isGL2GL3()
          Indicates whether this profile is capable os GL2GL3.
 boolean isGL3()
          Indicates whether this profile is capable of GL3.
 boolean isGL3bc()
          Indicates whether this profile is capable of GL3bc.
 boolean isGL4()
          Indicates whether this profile is capable of GL4.
 boolean isGL4bc()
          Indicates whether this profile is capable of GL4bc.
 boolean isGLES1()
          Indicates whether this profile is capable of GLES1.
 boolean isGLES2()
          Indicates whether this profile is capable of GLES2.
 boolean isValidArrayDataType(int index, int comps, int type, boolean isVertexAttribPointer, boolean throwException)
           
 boolean isValidDataType(int type, boolean throwException)
          General validation if type is a valid GL data type for the current profile
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 here.
Invoke shutdown() manually is recommended, due to the unreliable JVM state within the shutdown hook.
 String toString()
           
 boolean usesNativeGLES()
          Indicates whether this profile uses either of the native OpenGL ES implementations.
static boolean usesNativeGLES(String profileImpl)
          Indicates whether either of the native OpenGL ES profiles are in use.
 boolean usesNativeGLES1()
          Indicates whether this profile uses the native OpenGL ES1 implementations.
static boolean usesNativeGLES1(String profileImpl)
          Indicates whether the native OpenGL ES1 profile is in use.
 boolean usesNativeGLES2()
          Indicates whether this profile uses the native OpenGL ES2 implementations.
static boolean usesNativeGLES2(String profileImpl)
          Indicates whether the native OpenGL ES2 profile is in use.
 void verifyEquality(GLProfile glp)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG

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:
Constant Field Values

GL4

public static final String GL4
The desktop OpenGL core profile 4.x, with x >= 0

See Also:
Constant Field Values

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:
Constant Field Values

GL3

public static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1

See Also:
Constant Field Values

GL2

public static final String GL2
The desktop OpenGL profile 1.x up to 3.0

See Also:
Constant Field Values

GLES1

public static final String GLES1
The embedded OpenGL profile ES 1.x, with x >= 0

See Also:
Constant Field Values

GLES2

public static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0

See Also:
Constant Field Values

GL2ES1

public static final String GL2ES1
The intersection of the desktop GL2 and embedded ES1 profile

See Also:
Constant Field Values

GL2ES2

public static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile

See Also:
Constant Field Values

GL2GL3

public static final String GL2GL3
The intersection of the desktop GL3 and GL2 profile

See Also:
Constant Field Values

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.


GL_PROFILE_LIST_MAX

public static final String[] GL_PROFILE_LIST_MAX
Order of maximum profiles.


GL_PROFILE_LIST_MIN

public static final String[] GL_PROFILE_LIST_MIN
Order of minimum profiles.


GL_PROFILE_LIST_MIN_DESKTOP

public static final String[] GL_PROFILE_LIST_MIN_DESKTOP
Order of minimum original desktop profiles.


GL_PROFILE_LIST_MAX_FIXEDFUNC

public static final String[] GL_PROFILE_LIST_MAX_FIXEDFUNC
Order of maximum fixed function profiles


GL_PROFILE_LIST_MAX_PROGSHADER

public static final String[] GL_PROFILE_LIST_MAX_PROGSHADER
Order of maximum programmable shader profiles


GL_PROFILE_LIST_GL2ES2

public static final String[] GL_PROFILE_LIST_GL2ES2
All GL2ES2 Profiles in the order of default detection.

See Also:
GL_PROFILE_LIST_MAX_PROGSHADER

GL_PROFILE_LIST_GL2ES1

public static final String[] GL_PROFILE_LIST_GL2ES1
All GL2ES1 Profiles in the order of default detection.

See Also:
GL_PROFILE_LIST_MAX_FIXEDFUNC

GL_PROFILE_LIST_GLES

public static final String[] GL_PROFILE_LIST_GLES
All GLES Profiles in the order of default detection.

Method Detail

initSingleton

public static void initSingleton(boolean firstUIActionOnProcess)
Static one time initialization of JOGL.

The parameter firstUIActionOnProcess has an impact on concurrent locking,
see NativeWindowFactory.initSingleton(firstUIActionOnProcess).

Applications shall call this methods ASAP, before any other UI invocation.
You may issue the call in your main class static block, which is the earliest point in your application/applet lifecycle, or within the main function.
In case applications are able to initialize JOGL before any other UI action,
they shall invoke this method with firstUIActionOnProcess=true and benefit from fast native multithreading support on all platforms if possible.

RCP Application (Applet's, Webstart, Netbeans, ..) using JOGL may not be able to initialize JOGL before the first UI action.
In such case you shall invoke this method with firstUIActionOnProcess=false.
On some platforms, notably X11 with AWT usage, JOGL will utilize special locking mechanisms which may slow down your application.

Remark: NEWT is currently not affected by this behavior, ie always uses native multithreading.

However, in case this method is not invoked, hence GLProfile is not initialized explicitly by the user,
the first call to getDefault(), get(java.lang.String), etc, will initialize with firstUIActionOnProcess=false,
hence without the possibility to enable native multithreading.
This is not the recommended way, since it may has a performance impact, but it allows you to run code without explicit initialization.

Parameters:
firstUIActionOnProcess - Should be true if called before the first UI action of the running program, otherwise false.

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 here.
Invoke shutdown() manually is recommended, due to the unreliable JVM state within the shutdown hook.


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 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

Throws:
GLException - if no profile is available for the device.
See Also:
GL_PROFILE_LIST_ALL

getDefault

public static GLProfile getDefault()
Uses the default device

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

getMaximum

public static GLProfile getMaximum(AbstractGraphicsDevice device)
                            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:
GL_PROFILE_LIST_MAX

getMaximum

public static GLProfile getMaximum()
                            throws GLException
Uses the default device

Throws:
GLException - if no profile is available for the default device.
See Also:
GL_PROFILE_LIST_MAX

getMinimum

public static GLProfile getMinimum(AbstractGraphicsDevice device)
                            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:
GL_PROFILE_LIST_MIN

getMinimum

public static GLProfile getMinimum()
                            throws GLException
Uses the default device

Throws:
GLException - if no desktop profile is available for the default device.
See Also:
GL_PROFILE_LIST_MIN

getMaxFixedFunc

public static GLProfile getMaxFixedFunc(AbstractGraphicsDevice device)
                                 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:
GL_PROFILE_LIST_MAX_FIXEDFUNC

getMaxFixedFunc

public static GLProfile getMaxFixedFunc()
                                 throws GLException
Uses the default device

Throws:
GLException - if no fixed function profile is available for the default device.
See Also:
GL_PROFILE_LIST_MAX_FIXEDFUNC

getMaxProgrammable

public static GLProfile getMaxProgrammable(AbstractGraphicsDevice device)
                                    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:
GL_PROFILE_LIST_MAX_PROGSHADER

getMaxProgrammable

public static GLProfile getMaxProgrammable()
                                    throws GLException
Uses the default device

Throws:
GLException - if no programmable profile is available for the default device.
See Also:
GL_PROFILE_LIST_MAX_PROGSHADER

getGL2ES1

public static GLProfile getGL2ES1(AbstractGraphicsDevice device)
                           throws GLException
Returns an available GL2ES1 compatible profile. It returns the first available of the set: GL_PROFILE_LIST_GL2ES1.

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

getGL2ES1

public static GLProfile getGL2ES1()
                           throws GLException
Returns an available GL2ES1 compatible profile. It returns the first available of the set: GL_PROFILE_LIST_GL2ES1.

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

getGL2ES2

public static GLProfile getGL2ES2(AbstractGraphicsDevice device)
                           throws GLException
Returns an available GL2ES2 compatible profile. It returns the first available of the set: GL_PROFILE_LIST_GL2ES2.

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

getGL2ES2

public static GLProfile getGL2ES2()
                           throws GLException
Returns an available GL2ES2 compatible profile It returns the first available of the set: GL_PROFILE_LIST_GL2ES2.

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

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)
                     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, ..)
Throws:
GLException - if the non of the requested profiles is available for the device.

get

public static GLProfile get(String[] profiles)
                     throws GLException
Uses the default device

Parameters:
profiles - array of valid GLProfile name (GL4bc, GL4, GL2, ..)
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 ES2 profile is in use. This requires an EGL or ES2 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()

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()

getImplName

public final String getImplName()

isGL4bc

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


isGL4

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


isGL3bc

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


isGL3

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


isGL2

public final boolean isGL2()
Indicates whether this context is a GL2 context


isGLES1

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


isGLES2

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


isGL2ES1

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


isGL2ES2

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


isGL2GL3

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


hasGLSL

public final boolean hasGLSL()
Indicates whether this profile supports GLSL.


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.


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()

getDefaultDesktopDevice

public static AbstractGraphicsDevice getDefaultDesktopDevice()

getDefaultEGLDevice

public static AbstractGraphicsDevice getDefaultEGLDevice()


Copyright 2010 JogAmp Community.