Skip to content

DXBufferCreate

DXBufferCreate

Creates a buffer of a specified type based on a data array.

int  DXBufferCreate(
   int                  context,               // graphic context handle
   ENUM_DX_BUFFER_TYPE  buffer_type,           // type of a created buffer
   const void&          data[],                // buffer data
   uint                 start=0,               // initial index
   uint                 count=WHOLE_ARRAY      // number of elements
   );

Parameters

context

[in] Handle for a graphic context created in DXContextCreate().

buffer_type

[in] Buffer type from the ENUM_DX_BUFFER_TYPE enumeration.

data[]

[in] Data for creating a buffer.

start=0

[in] Index of the first element of the array, starting from which the array values are used to create a buffer. By default, the data is taken from the beginning of the array.

count=WHOLE_ARRAY

[in] Number of values. By default, the entire array is used (count=WHOLE_ARRAY).

Return Value

The handle for a created buffer or INVALID_HANDLE in case of an error. To receive an error code, the GetLastError() function should be called.

Note

For the index buffer, the data[] array should be of ‘uint’ type, while the vertex buffer receives the array of structures describing vertices.

A created handle that is no longer in use should be explicitly released by the DXRelease() function.

ENUM_DX_BUFFER_TYPE

IDValueDescription
DX_BUFFER_VERTEX1Vertex buffer
DX_BUFFER_INDEX2Index buffer
Last updated on