cgGetProgramBuffer
Keywords: cgGetProgramBuffer, NVIDIA, NVIDIA Cg Toolkit, Cg Toolkit, Shader, Shader Programming, GPU Shader Programming, GPU Program

> ## Name

> cgGetProgramBuffer - get buffer associated with a buffer index

> ## Synopsis

>     #include <Cg/cg.h>

>     CGbuffer cgGetProgramBuffer( CGprogram program,
>                                  int bufferIndex );

> ## Parameters

> program
>   The program from which the associated buffer will be retrieved.
> bufferIndex
>   The buffer index for which the associated buffer will be retrieved.

> ## Return Values

> Returns a buffer handle on success.

> Returns NULL if an error occurs.

> ## Description

> cgGetProgramBuffer returns the buffer handle associated with a given buffer index from program. The returned value can be NULL if no buffer is associated with this index or if an error occurs.

> ## Examples

> CGbuffer myBuffer = cgGetProgramBuffer( myProgram, 0 );

> ## Errors

> CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.

> CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR is generated if bufferIndex is not within the valid range of buffer indices for program.

> ## History

> cgGetProgramBuffer was introduced in Cg 2.0.

> ## See Also

> cgSetProgramBuffer, cgGetParameterBufferIndex, cgCreateBuffer