cgGLSetStateMatrixParameter
Keywords: cgGLSetStateMatrixParameter, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgGLSetStateMatrixParameter - set the values of a matrix parameter to a matrix in the OpenGL state

> ## Synopsis

>     #include <Cg/cgGL.h>

>     void cgGLSetStateMatrixParameter( CGparameter param,
>                                       CGGLenum matrix,
>                                       CGGLenum transform );

> ## Parameters

> param
>   The matrix parameter that will be set.
> matrix
>   An enumerant indicating which matrix should be retrieved from the OpenGL state. Must be one of the following :
>   - CG_GL_MODELVIEW_MATRIX
>   - CG_GL_PROJECTION_MATRIX
>   - CG_GL_TEXTURE_MATRIX
>   - CG_GL_MODELVIEW_PROJECTION_MATRIX
> transform
>   An enumerant indicating an optional transformation that may be applied to the matrix before it is set. Must be one of the following :
>   - CG_GL_MATRIX_IDENTITY
>   - CG_GL_MATRIX_TRANSPOSE
>   - CG_GL_MATRIX_INVERSE
>   - CG_GL_MATRIX_INVERSE_TRANSPOSE

> ## Return Values

> None.

> ## Description

> cgGLSetStateMatrixParameter sets a matrix parameter to the values retrieved from an OpenGL state matrix. The state matrix to retrieve is indicated by matrix, which may be one of the following :

> CG_GL_MODELVIEW_MATRIX
>   Get the current modelview matrix.
> CG_GL_PROJECTION_MATRIX
>   Get the current projection matrix.
> CG_GL_TEXTURE_MATRIX
>   Get the current texture matrix.
> CG_GL_MODELVIEW_PROJECTION_MATRIX
>   Get the concatenated modelview and projection matrices.

> The transform parameter specifies an optional transformation which will be applied to the retrieved matrix before setting the values in the parameter. transform must be one of the following :

> CG_GL_MATRIX_IDENTITY
>   Don't apply any transform, leaving the matrix as is.
> CG_GL_MATRIX_TRANSPOSE
>   Transpose the matrix.
> CG_GL_MATRIX_INVERSE
>   Invert the matrix.
> CG_GL_MATRIX_INVERSE_TRANSPOSE
>   Transpose and invert the matrix.

> cgGLSetStateMatrixParameter may only be called with a uniform matrix parameter. If the size of the matrix is less than 4x4, the upper left corner of the matrix that fits into the given matrix parameter will be returned.

> ## Examples

> to-be-written

> ## Errors

> CG_INVALID_PROFILE_ERROR is generated if param's profile is not a supported OpenGL profile.

> CG_NOT_MATRIX_PARAM_ERROR is generated if param is not a matrix parameter.

> CG_INVALID_ENUMERANT_ERROR is generated if either matrix or transform is not one of the allowed enumerant values.

> CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

> CG_INVALID_PARAMETER_ERROR is generated if the parameter fails to set for any other reason.

> ## History

> cgGLSetStateMatrixParameter was introduced in Cg 1.1.

> ## See Also

> cgGLSetMatrixParameter, cgGLGetMatrixParameter