Name

cgGetNumStateEnumerants - gets the number of enumerants associated with a state

Synopsis

#include <Cg/cg.h>

int cgGetNumStateEnumerants( CGstate state );

Parameters

state
The state from which to retrieve the number of associated enumerants.

Return Values

Returns the number of enumerants associated with state.

Returns 0 if an error occurs.

Description

cgGetNumStateEnumerants returns the number of enumerants associated with a given CGstate. Enumerants can be added to a CGstate using cgAddStateEnumerant.

Examples

int value;
char* pName;

int nEnums = cgGetNumStateEnumerants(state);

for (ii=0; ii<nEnums; ++ii) {
    pName = cgGetStateEnumerant(state, ii, &value );
    printf("%i: %s %i\n", ii+1, pName, value);
}

Errors

CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.

History

cgGetNumStateEnumerants was introduced in Cg 2.2.

See Also

cgAddStateEnumerant, cgGetStateEnumerant, cgGetStateEnumerantName, cgGetStateEnumerantValue