### Constructor

# Cogl AttributeBuffer new

#### Declaration [src]

    CoglAttributeBuffer*
    cogl_attribute_buffer_new (
      CoglContext* context,
      size_t bytes,
      void* data
    )

#### Description [src]

Describes a new `CoglAttributeBuffer` of `size` bytes to contain arrays of vertex attribute data and also uploads `size` bytes read from `data` to the new buffer.

You should never pass a `NULL` data pointer.

This function does not report out-of-memory errors back to the caller by returning `NULL` and so you can assume this function always succeeds.

In the unlikely case that there is an out of memory problem then Cogl will abort the application with a message. If your application needs to gracefully handle out-of-memory errors then you can use `cogl_attribute_buffer_new_with_size()` and then explicitly catch errors with `cogl_buffer_set_data()` or cogl_buffer_map().

#### Parameters

`context`

  Type: `CoglContext`

  A `CoglContext`.

  The data is owned by the caller of the function.

`bytes`

  Type: `size_t`

  The number of bytes to allocate for vertex attribute data.

`data`

  Type: An array of `guint8`

  An optional pointer to vertex data to upload immediately.

  The length of the array is specified in the `bytes` argument.
  The data is owned by the caller of the function.

#### Return value

Type: `CoglAttributeBuffer`

A newly allocated `CoglAttributeBuffer` (never `NULL`).

The caller of the function takes ownership of the data, and is responsible for freeing it.