Name
cgGLCreateBuffer - create an OpenGL buffer object
Synopsis
#include <Cg/cgGL.h>
CGbuffer cgGLCreateBuffer( CGcontext context,
int size,
const void *data,
GLenum bufferUsage );
Parameters
- context
-
The context to which the new buffer will be added.
- size
-
The length in bytes of the buffer to create.
- data
-
The inital data to be copied into the buffer. NULL will fill the buffer with zero.
- bufferUsage
-
One of the usage flags specified as valid for glBufferData.
Return Values
Returns a CGbuffer handle on success.
Returns NULL if any error occurs.
Description
cgGLCreateBuffer creates an OpenGL buffer object.
Examples
CGbuffer myBuffer = cgGLCreateBuffer( myCgContext, sizeof( float ) * 16,
myData, GL_STATIC_DRAW );
Errors
CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.
CG_MEMORY_ALLOC_ERROR is generated if a buffer couldn't be created.
History
cgGLCreateBuffer was introduced in Cg 2.0.
See Also
cgCreateBuffer,
cgGLCreateBufferFromObject,
cgGLGetBufferObject
|