> ## Name

> cgGLGetLatestProfile - get the latest profile for a profile class

> ## Synopsis

>     #include <Cg/cgGL.h>

>     CGprofile cgGLGetLatestProfile( CGGLenum profileClass );

> ## Parameters

> profileClass
>   The class of profile that will be returned. Must be one of the following :
>   - CG_GL_VERTEX
>   - CG_GL_GEOMETRY
>   - CG_GL_FRAGMENT
>   - CG_GL_TESSELLATION_CONTROL
>   - CG_GL_TESSELLATION_EVALUATION

> ## Return Values

> Returns a profile enumerant for the latest profile of the given class.

> Returns CG_PROFILE_UNKNOWN if no appropriate profile is available or an error occurs.

> ## Description

> cgGLGetLatestProfile returns the best available profile of a given class. The OpenGL extensions are checked to determine the best profile which is supported by the current GPU, driver, and cgGL library combination.

> profileClass may be one of the following enumerants :

> CG_GL_VERTEX
>   The latest available vertex profile will be returned.
> CG_GL_GEOMETRY
>   The latest available geometry profile will be returned.
> CG_GL_FRAGMENT
>   The latest available fragment profile will be returned.
> CG_GL_TESSELLATION_CONTROL
>   The latest available tessellation control profile will be returned.
> CG_GL_TESSELLATION_EVALUATION
>   The latest available tessellation evaluation profile will be returned.

> cgGLGetLatestProfile can be used in conjuction with cgCreateProgram to ensure that more optimal profiles are used as they are made available, even though they might not have been available at compile time or with a different version of the runtime.

> Starting in Cg 2.2, certain environment variables can override the value returned by cgGLGetLatestProfile:

> If cgGLGetLatestProfile is called with profileClass being CG_GL_VERTEX and an environment variable named `CGGL_LATEST_VERTEX_PROFILE` is set in the application's environment to a string that cgGetProfile translates to a valid profile (meaning not `CG_PROFILE_UNKNOWN`), the CGprofile value returned by cgGetProfile is returned by cgGLGetLatestProfile.

> If cgGLGetLatestProfile is called with profileClass being CG_GL_GEOMETRY and an environment variable named `CGGL_LATEST_GEOMETRY_PROFILE` is set in the application's environment to a string that cgGetProfile translates to a valid profile (meaning not `CG_PROFILE_UNKNOWN`), the CGprofile value returned by cgGetProfile is returned by cgGLGetLatestProfile.

> If cgGLGetLatestProfile is called with profileClass being CG_GL_FRAGMENT and an environment variable named `CGGL_LATEST_FRAGMENT_PROFILE` is set in the application's environment to a string that cgGetProfile translates to a valid profile (meaning not `CG_PROFILE_UNKNOWN`), the CGprofile value returned by cgGetProfile is returned by cgGLGetLatestProfile.

> If cgGLGetLatestProfile is called with profileClass being CG_GL_TESSELLATION_CONTROL and an environment variable named `CGGL_LATEST_TESSELLATION_CONTROL_PROFILE` is set in the application's environment to a string that cgGetProfile translates to a valid profile (meaning not `CG_PROFILE_UNKNOWN`), the CGprofile value returned by cgGetProfile is returned by cgGLGetLatestProfile.

> If cgGLGetLatestProfile is called with profileClass being CG_GL_TESSELLATION_EVALUATION and an environment variable named `CGGL_LATEST_TESSELLATION_EVALUATION_PROFILE` is set in the application's environment to a string that cgGetProfile translates to a valid profile (meaning not `CG_PROFILE_UNKNOWN`), the CGprofile value returned by cgGetProfile is returned by cgGLGetLatestProfile.

> ## Examples

>     /* Output information about available profiles */
>     printf("vertex profile:   %s\n",
>            cgGetProfileString(cgGLGetLatestProfile(CG_GL_VERTEX)));
>     printf("geometry profile: %s\n",
>            cgGetProfileString(cgGLGetLatestProfile(CG_GL_GEOMETRY)));
>     printf("fragment profile: %s\n",
>            cgGetProfileString(cgGLGetLatestProfile(CG_GL_FRAGMENT)));
>     printf("tessellation control profile: %s\n",
>            cgGetProfileString(cgGLGetLatestProfile(CG_GL_TESSELLATION_CONTROL)));
>     printf("tessellation evalutation profile: %s\n",
>            cgGetProfileString(cgGLGetLatestProfile(CG_GL_TESSELLATION_EVALUATION)));

> ## Errors

> CG_INVALID_ENUMERANT_ERROR is generated if profileClass is not CG_GL_VERTEX, CG_GL_GEOMETRY, CG_GL_FRAGMENT, CG_GL_TESSELLATION_CONTROL, or CG_GL_TESSELLATION_EVALUATION.

> ## History

> cgGLGetLatestProfile was introduced in Cg 1.1.

> CG_GL_GEOMETRY support was introduced in Cg 2.0.

> CG_GL_TESSELLATION_CONTROL and CG_GL_TESSELLATION_EVALUATION support was introduced in Cg 3.0.

> ## See Also

> cgGLSetOptimalOptions, cgCreateProgram