### Method

# Cogl Buffer map

#### Declaration [src]

    void*
    cogl_buffer_map (
      CoglBuffer* buffer,
      CoglBufferAccess access,
      CoglBufferMapHint hints
    )

#### Description [src]

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.

It is strongly recommended that you pass `COGL_BUFFER_MAP_HINT_DISCARD` as a hint if you are going to replace all the buffer’s data. This way if the buffer is currently being used by the GPU then the driver won’t have to stall the CPU and wait for the hardware to finish because it can instead allocate a new buffer to map.

The behaviour is undefined if you access the buffer in a way conflicting with the `access` mask you pass. It is also an error to release your last reference while the buffer is mapped.

#### Parameters

`access`

  Type: `CoglBufferAccess`

  How the mapped buffer will be used by the application.

`hints`

  Type: `CoglBufferMapHint`

  A mask of `CoglBufferMapHint`s that tell Cogl how the data will be modified once mapped.

#### Return value

Type: `void*`

A pointer to the mapped memory or `NULL` is the call fails.

The returned data is owned by the instance.
The return value can be `NULL`.