Name
cgGLCreateBufferFromObject - create a Cg buffer from an OpenGL buffer object
Synopsis
#include <Cg/cgGL.h> CGbuffer cgGLCreateBufferFromObject( CGcontext context, GLuint obj, CGbool manageObject );Parameters
- context
- The context to which the new buffer will be added.
- obj
- One of the usage flags specified as valid for glBufferData.
- manageObject
- A boolean switch which controls whether obj will be deleted by the runtime when the CGbuffer object returned by cgGLCreateBufferFromObject is destroyed.
Return Values
Returns a CGbuffer handle on success.
Returns NULL if any error occurs.
Description
cgGLCreateBufferFromObject creates a Cg buffer from a preexisting OpenGL buffer object. This GL object will be deleted by the runtime when the Cg buffer is destroyed if manageObject is CG_TRUE. Otherwise the application is responsibile for deleting the GL object obj.
Examples
CGbuffer myBuffer = cgGLCreateBufferFromObject( myCgContext, glBufferId, CG_TRUE );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
cgGLCreateBufferFromObject was introduced in Cg 3.1.
See Also
cgCreateBuffer, cgDestroyBuffer, cgGLCreateBuffer, cgGLGetBufferObject