cgSetEffectParameterBuffer(3)

NAME
cgSetEffectParameterBuffer - sets a Cg buffer to every program in the effect that uses the passed effect buffer parameter.

SYNOPSIS
  #include <Cg/cg.h>

  void cgSetEffectParameterBuffer(CGparameter param,
                                  CGbuffer buffer)

PARAMETERS

param
    The effect parameter used by programs in the effect as a buffer parameter.

buffer
    The Cg buffer being set to param for each program in the effect that uses param.

RETURN VALUES
None.

DESCRIPTION
cgSetEffectParameterBuffer allows the application with a single API call to set a Cg buffer to an effect parameter using the BUFFER semantic for each program in the effect that uses this effect parameter.

cgSetEffectParameterBuffer does the equivalent of the following:

  CGtechnique technique = cgGetFirstTechnique(myCgEffect);
  for(; technique; technique = cgGetNextTechnique(technique))
  {
    if(!cgIsTechniqueValidated(technique))
      continue;

    CGpass pass = cgGetFirstPass(technique);
    for(; pass; pass = cgiGetNextPass(pass))
    {
      for(int i = 0; i < numDomains; ++i)
      {
        CGprogram prog = cgGetPassProgram(pass, domains[i]);
        if(!prog)
          continue;

        CGparameter param = cgGetNamedParameter(prog, "paramName");
        CGbool isUsed = cgIsParameterUsed(param, prog);
        if(isUsed == CG_FALSE)
          continue;

        int idx = cgGetParameterBufferIndex(param);
        if(idx < 0)
          continue;

        cgSetProgramBuffer(prog, idx, myCgBuffer);
      }
    }
  }

EXAMPLES
  cgSetEffectParameterBuffer(cgGetNamedEffectParameter(myCgEffect, "paramName"), myCgBuffer);

  See examples/OpenGL/advanced/cgfx_buffer_lighting.

ERRORS
CG_INVALID_PARAMETER_ERROR is generated if param is not a valid parameter.

HISTORY
cgSetEffectParameterBuffer was introduced in Cg 3.0.

SEE ALSO
cgGetEffectParameterBuffer, cgSetProgramBuffer