> ## Name

> cgSetBufferData - resize and completely update a buffer object

> ## Synopsis

>     #include <Cg/cg.h>

>     void cgSetBufferData( CGbuffer buffer,
>                           int size,
>                           const void * data );

> ## Parameters

> buffer
>   The buffer which will be updated.
> size
>   Specifies a new size for the buffer object. Zero for size means use the existing size of the buffer as the effective size.
> data
>   Pointer to the data to copy into the buffer. The number of bytes to copy is determined by the size parameter.

> ## Return Values

> None.

> ## Description

> cgSetBufferData resizes and completely updates an existing buffer object.

> A buffer which has been mapped into an applications address space with cgMapBuffer must be unmapped using cgUnmapBuffer before it can be updated with cgSetBufferData.

> ## Examples

> cgSetBufferData( myBuffer, sizeof( myData ), myData );

> ## Errors

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

> CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR is generated if buffer is currently mapped.

> ## History

> cgSetBufferData was introduced in Cg 2.0.

> ## See Also

> cgCreateBuffer, cgGLCreateBuffer, cgSetBufferSubData, cgMapBuffer, cgUnmapBuffer