> # NAME

> cgCreateBuffer - create a buffer object managed by the runtime

> # SYNOPSIS

>       #include <Cg/cg.h>

>       CGbuffer cgCreateBuffer( CGcontext context,
>                                int size,
>                                const void *data,
>                                CGbufferusage bufferUsage );

> # PARAMETERS

> context

>   The context to which the new buffer will be added.

> size

>   The length in bytes of the buffer to create.

> data

>   Pointer to inital buffer data. NULL will fill the buffer with zero.

> bufferUsage

>   Indicates the intended usage method of the buffer.

>   Can be one of the following types:

>   - CG_BUFFER_USAGE_STREAM_DRAW
>   - CG_BUFFER_USAGE_STREAM_READ
>   - CG_BUFFER_USAGE_STREAM_COPY
>   - CG_BUFFER_USAGE_STATIC_DRAW
>   - CG_BUFFER_USAGE_STATIC_READ
>   - CG_BUFFER_USAGE_STATIC_COPY
>   - CG_BUFFER_USAGE_DYNAMIC_DRAW
>   - CG_BUFFER_USAGE_DYNAMIC_READ
>   - CG_BUFFER_USAGE_DYNAMIC_COPY

> # RETURN VALUES

> Returns a CGbuffer handle on success.

> Returns NULL if an error occurs.

> # DESCRIPTION

> cgCreateBuffer creates a runtime managed Cg buffer object.

> There is no way to query the 3D API-specific resource for a managed buffer. cgGLCreateBuffer should be used if the application wishes to later query the 3D API-specific resource for the buffer.

> # EXAMPLES

>       CGbuffer myBuffer = cgCreateBuffer( myCgContext, sizeof( float ) * 16,
>                                           initalData, CG_BUFFER_USAGE_STATIC_DRAW );

> # ERRORS

> CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

> # HISTORY

> cgCreateBuffer was introduced in Cg 2.0.

> # SEE ALSO

> cgGLCreateBuffer, cgDestroyBuffer