cgGetNextParameter

Langue: en

Version: 46999 (openSuse - 09/10/07)

Section: 3 (Bibliothèques de fonctions)

NAME

cgGetNextParameter - iterate through a program's or effect's parameters

SYNOPSIS


  #include <Cg/cg.h>






  CGparameter cgGetNextParameter( CGparameter current );





PARAMETERS


current
The current parameter.

RETURN VALUES

Returns the next parameter in the program or effect's internal sequence of parameters.

Returns NULL when current is the last parameter in the program or effect.

DESCRIPTION

The parameters of a program or effect can be iterated over using cgGetNextParameter with the cgGetFirstParameter manpage, the cgGetNextStructParameter manpage, or the cgGetArrayParameter manpage.

Similarly, the parameters in an effect can be iterated over starting with a call to the cgGetFirstEffectParameter manpage.

Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each parameter will be visited exactly once.

EXAMPLES


  void RecurseParams( CGparameter param )

  {

    if(!param)

      return;






    do

    {

      switch(cgGetParameterType(param))

      {

        case CG_STRUCT :

          RecurseParams(cgGetFirstStructParameter(param));

          break;






        case CG_ARRAY :

          {

            int ArraySize = cgGetArraySize(param, 0);

            int i;






            for(i=0; i < ArraySize; ++i)

              RecurseParams(cgGetArrayParameter(param, i));

          }

          break;






        default :

          /* Do stuff to param */

      }

    } while((param = cgGetNextParameter(param)) != 0);

  }






  void RecurseParamsInProgram( CGprogram program )

  {

    RecurseParams( cgGetFirstParameter( program ) );

  }





ERRORS

CG_INVALID_PARAM_HANDLE_ERROR is generated if param is not a valid parameter.

HISTORY

cgGetNextParameter was introduced in Cg 1.1.

SEE ALSO

the cgFirstParameter manpage, the cgFirstEffectParameter manpage, the cgGetFirstStructParameter manpage, the cgGetArrayParameter manpage, the cgGetParameterType manpage