NAME

cgGetParameterBaseResource - get a parameter's base resource

SYNOPSIS

  #include <Cg/cg.h>

  CGresource cgGetParameterBaseResource( CGparameter param );

PARAMETERS

param

The parameter.

RETURN VALUES

Returns the base resource of param.

Returns CG_UNDEFINED if no base resource exists for the given parameter.

DESCRIPTION

cgGetParameterBaseResource allows the application to retrieve the base resource for a parameter in a Cg program. The base resource is the first resource in a set of sequential resources. For example, if a given parameter has a resource of CG_ATTR7, it's base resource would be CG_ATTR0. Only parameters with resources whose name ends with a number will have a base resource. For all other parameters the undefined resource CG_UNDEFINED will be returned.

The numerical portion of the resource may be retrieved with cgGetParameterResourceIndex. For example, if the resource for a given parameter is CG_ATTR7, cgGetParameterResourceIndex will return 7.

EXAMPLES

  /* log info about parameter param for debugging */

  printf("Resource: %s:%d (base %s)\n", 
    cgGetResourceString(cgGetParameterResource(param)),
    cgGetParameterResourceIndex(param),
    cgGetResourceString(cgGetParameterBaseResource(param)));

ERRORS

CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

CG_INVALID_PARAMETER_ERROR is generated if param is not a leaf node.

HISTORY

cgGetParameterBaseResource was introduced in Cg 1.1.

SEE ALSO

cgGetParameterResource, cgGetParameterResourceIndex, cgGetResourceString