cgSetProgramBuffer

> # NAME

> cgSetProgramBuffer - set a buffer for a program

> # SYNOPSIS

>       #include <Cg/cg.h>

>       void cgSetProgramBuffer( CGprogram program,
>                                int bufferIndex,
>                                CGbuffer buffer );

> # PARAMETERS

> program

>   The program for which the buffer will be set.

> bufferIndex

>   The buffer index of program to which buffer will be bound.

> buffer

>   The buffer to be bound.

> # RETURN VALUES

> None.

> # DESCRIPTION

> cgSetProgramBuffer sets the buffer for a given buffer index of a program. A NULL buffer handle means the given buffer index should not be bound to a buffer.

> bufferIndex must be non-negative and within the program's range of buffer indices. For OpenGL programs, bufferIndex can be 0 to 11. For Direct3D10 programs, bufferIndex can be 0 to 15.

> When the next program bind operation occurs, each buffer index which is set to a valid buffer handle is bound (along with the program) for use by the 3D API. No buffer bind operation occurs for buffer indices bound to a NULL buffer handle.

> # EXAMPLES

> cgSetProgramBuffer( myProgram, 2, myBuffer );

> # ERRORS

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

> CG_INVALID_BUFFER_HANDLE_ERROR is generated if buffer is not a valid buffer.

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

> # HISTORY

> cgSetProgramBuffer was introduced in Cg 2.0.

> # SEE ALSO

> cgCreateBuffer, cgGetProgramBuffer, cgGLBindProgram, cgD3D9BindProgram, cgD3D8BindProgram