![]() |
![]() |
![]() |
Cogl Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
CoglBool cogl_is_buffer (); unsigned
void *objectint cogl_buffer_get_size (); enum CoglBufferUpdateHint;
CoglBuffer *buffervoid cogl_buffer_set_update_hint (,
CoglBuffer *bufferCoglBufferUpdateHint hint
); CoglBufferUpdateHint cogl_buffer_get_update_hint (); enum CoglBufferAccess;
CoglBuffer *buffervoid * cogl_buffer_map (,
CoglBuffer *bufferCoglBufferAccess access
,);
CoglBufferMapHint hintsvoid cogl_buffer_unmap ();
CoglBuffer *bufferCoglBool cogl_buffer_set_data (,
CoglBuffer *buffer,
size_t offsetconst
,void *data);
size_t sizeCoglPixelBuffer * cogl_pixel_buffer_new (,
CoglContext *context,
size_t sizeconst
);void *dataCoglBool cogl_is_pixel_buffer ();
void *object
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()
Data can either be uploaded by supplying a pointer and size so Cogl
can copy your data, or you can mmap()
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.
CoglBool cogl_is_buffer ();
void *object
Checks whether buffer
is a buffer object.
|
a buffer object |
Returns : |
TRUE FALSE |
Since 1.2
Stability Level: Unstable
unsignedint cogl_buffer_get_size ();
CoglBuffer *buffer
Retrieves the size of buffer
|
a buffer object |
Returns : |
the size of the buffer in bytes |
Since 1.2
Stability Level: Unstable
typedef enum { /*< prefix=COGL_BUFFER_UPDATE_HINT >*/ COGL_BUFFER_UPDATE_HINT_STATIC, COGL_BUFFER_UPDATE_HINT_DYNAMIC, COGL_BUFFER_UPDATE_HINT_STREAM } CoglBufferUpdateHint;
The update hint on a buffer allows the user to give some detail on how often the buffer data is going to be updated.
the buffer will not change over time | |
the buffer will change from time to time | |
the buffer will be used once or a couple of times |
Since 1.2
Stability Level: Unstable
void cogl_buffer_set_update_hint (,
CoglBuffer *bufferCoglBufferUpdateHint hint
);
Sets the update hint on a buffer. See CoglBufferUpdateHint for a description of the available hints.
|
a buffer object |
|
the new hint |
Since 1.2
Stability Level: Unstable
CoglBufferUpdateHint cogl_buffer_get_update_hint (CoglBuffer *buffer
);
Retrieves the update hints set using cogl_buffer_set_update_hint()
|
a buffer object |
Returns : |
the CoglBufferUpdateHint currently used by the buffer |
Since 1.2
Stability Level: Unstable
typedef enum { /*< prefix=COGL_BUFFER_ACCESS >*/ COGL_BUFFER_ACCESS_READ = 1 << 0, COGL_BUFFER_ACCESS_WRITE = 1 << 1, COGL_BUFFER_ACCESS_READ_WRITE = COGL_BUFFER_ACCESS_READ | COGL_BUFFER_ACCESS_WRITE } CoglBufferAccess;
The access hints for cogl_buffer_set_update_hint()
the buffer will be read | |
the buffer will written to | |
the buffer will be used for both reading and writing |
Since 1.2
Stability Level: Unstable
void * cogl_buffer_map (,
CoglBuffer *bufferCoglBufferAccess access
,);
CoglBufferMapHint hints
Maps the buffer into the application address space for direct
access. This is equivalent to calling cogl_buffer_map_range()
It is strongly recommended that you pass
COGL_BUFFER_MAP_HINT_DISCARD
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.
|
a buffer object |
|
how the mapped buffer will be used by the application |
|
A mask of |
Returns : |
A pointer to the mapped memory or NULL |
Since 1.2
Stability Level: Unstable
void cogl_buffer_unmap ();
CoglBuffer *buffer
Unmaps a buffer previously mapped by cogl_buffer_map()
.
|
a buffer object |
Since 1.2
Stability Level: Unstable
CoglBool cogl_buffer_set_data (,
CoglBuffer *buffer,
size_t offsetconst
,void *data);
size_t size
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.
|
a buffer object |
|
destination offset (in bytes) in the buffer |
|
a pointer to the data to be copied into the buffer |
|
number of bytes to copy |
Returns : |
TRUE FALSE |
Since 1.2
Stability Level: Unstable
CoglPixelBuffer * cogl_pixel_buffer_new (,
CoglContext *context,
size_t sizeconst
);void *data
Declares a new size
bytes to contain arrays of
pixels. Once declared, data can be set using cogl_buffer_set_data()
or by mapping it into the application's address space using
cogl_buffer_map()
.
If data
isn't NULL
size
bytes will be read from data
and
immediately copied into the new buffer.
|
A |
|
The number of bytes to allocate for the pixel data. |
|
An optional pointer to vertex data to upload immediately |
Since 1.10
Stability Level: Unstable
CoglBool cogl_is_pixel_buffer ();
void *object
Checks whether object
is a pixel buffer.
|
a CoglObject to test |
Returns : |
TRUE object is a pixel buffer, and FALSE |
Since 1.2
Stability Level: Unstable