### Class

# Cogl Buffer

#### Description [src]

    abstract class Cogl.Buffer : GObject.Object
    {
      /* No available fields */
    }

Common buffer functions, including data upload APIs

The CoglBuffer API provides a common interface to manipulate buffers that have been allocated either via `cogl_pixel_buffer_new()` or `cogl_attribute_buffer_new()`. The API allows you to upload data to these buffers and define usage hints that help Cogl manage your buffer optimally.

Data can either be uploaded by supplying a pointer and size so Cogl can copy your data, or you can `mmap()` a CoglBuffer and then you can copy data to the buffer directly.

One of the most common uses for CoglBuffers is to upload texture data asynchronously since the ability to mmap the buffers into the CPU makes it possible for another thread to handle the IO of loading an image file and unpacking it into the mapped buffer without blocking other Cogl operations.

#### Ancestors

- GObject

#### Descendants

- CoglAttributeBuffer
- CoglIndexBuffer
- CoglPixelBuffer

#### Instance methods

###### cogl_buffer_get_size

Retrieves the size of buffer.

###### cogl_buffer_get_update_hint

Retrieves the update hints set using `cogl_buffer_set_update_hint()`.

###### cogl_buffer_map

Maps the buffer into the application address space for direct access. This is equivalent to calling `cogl_buffer_map_range()` with zero as the offset and the size of the entire buffer as the size.

###### cogl_buffer_map_range

Maps a sub-region of the buffer into the application’s address space for direct access.

###### cogl_buffer_set_data

Updates part of the buffer with new data from `data`. Where to put this new data is controlled by `offset` and `offset` + `data` should be less than the buffer size.

###### cogl_buffer_set_update_hint

Sets the update hint on a buffer. See `CoglBufferUpdateHint` for a description of the available hints.

###### cogl_buffer_unmap

Unmaps a buffer previously mapped by `cogl_buffer_map()`.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Cogl.Buffer:context

No description available.

###### Cogl.Buffer:default-target

No description available.

###### Cogl.Buffer:impl

No description available.

###### Cogl.Buffer:size

No description available.

###### Cogl.Buffer:update-hint

No description available.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct CoglBufferClass {
      /* no available fields */
    }

No description available.