NAME

cgCreateState - create a new state definition

SYNOPSIS

  #include <Cg/cg.h>

  CGstate cgCreateState(CGcontext cgfx, const char *name, CGtype type);

PARAMETERS

ctx

Specifies the context to define the state in.

name

Specifies the name of the new state.

type

Specifies the type of the new state.

DESCRIPTION

cgCreateState adds a new state definition to the context. When a CgFX file is later added to the context, all state assignments in passes in the file must have been defined ahead of time via a call to cgCreateState or cgCreateArrayState.

Applications will typically call cgSetStateCallbacks shortly after creating a new state with cgCreateState.

RETURN VALUES

cgCreateState returns a handle to the newly created CGstate. If there is an error, NULL is returned.

ERRORS

CG_INVALID_CONTEXT_HANDLE_ERROR is generated if ctx does not refer to a valid context.

CG_INVALID_PARAMETER_ERROR is generated if name is NULL or not a valid identifier, as well as if type is not a simple scalar, vector, or matrix-type. (Array-typed state should be created with cgCreateArrayState.)

SEE ALSO

cgCreateArrayState, cgGetStateName, cgGetStateType, cgIsState, cgSetStateCallbacks, and cgGLRegisterStates.