libgpcogl - API reference

Buffers

typedef GLuint gpcogl_buffer_id_t;

gpcogl_buffer_id_t gpcogl_buffer_init(gpcogl_t *ctx, GLuint binding, const void *inp, int size_in_bytes);

int gpcogl_buffer_get(gpcogl_t *ctx, gpcogl_buffer_id_t buffid, void *dst, GLintptr offset, GLsizeiptr size_in_bytes);

void gpcogl_buffer_free(gpcogl_t *ctx, gpcogl_buffer_id_t buffid);

#define GPCOGL_BUFFER(name, binding)

An buffer is a shared blobb of binary data in GPU memory. Shared means all shader instances can access it read-write during execution. It is created using te gpcogl_buffer_init() call which returns the gpcogl_buffer_id_t of the new buffer; the C prorgam references the buffer by this ID. Binding is an arbitrary but unique integer value by which the shader program will identify the buffer; this number is in its own namespace for buffers. When the buffer is created, an initial value is loaded into GPU memory, then shader programs can declare it using the GPCOGL_BUFFER() followed by the specificaiton of the internal structure of the buffer.

The buffer resides in GPU memory. The C program can query the current content of the buffer, typically after a compute call, using gpcogl_buffer_get().

The buffer persists and is accessible to all shader programs in the given context until gpcogl_buffer_free() is called on it.

The example line_dir_find demonstrates using a (shared) buffer array to assamble a sequential list of items found while processing.

Requirement

Requires OpenGL 4.3 or extension "ARB_shader_storage_buffer_object".