Name

cgD3D10CreateBufferFromObject - create a Cg buffer from a D3D10 buffer object

Synopsis

#include <Cg/cgD3D10.h>

CGbuffer cgD3D10CreateBufferFromObject( CGcontext context,
                                        ID3D10Buffer * obj,
                                        CGbool manageObject );

Parameters

context
The context to which the new buffer will be added.
obj
A D3D10 buffer object created by the application.
manageObject
A boolean switch which controls whether obj will be deleted by the runtime when the CGbuffer object returned by cgD3D10CreateBufferFromObject is destroyed.

Return Values

Returns a CGbuffer handle on success.

Returns NULL if any error occurs.

Description

cgD3D10CreateBufferFromObject creates a Cg buffer from a preexisting D3D10 buffer object. This D3D10 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 D3D10 object obj.

Examples

  CGbuffer myBuffer = cgD3D10CreateBufferFromObject( myCgContext, d3d10BufferObj, CG_TRUE );

Errors

CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

History

cgD3D10CreateBufferFromObject was introduced in Cg 3.1.

See Also

cgCreateBuffer, cgDestroyBuffer, cgD3D10GetBufferByIndex