Example #1
0
CoglIndices *
cogl_indices_new (CoglContext *context,
                  CoglIndicesType type,
                  const void *indices_data,
                  int n_indices)
{
  size_t buffer_bytes = sizeof_indices_type (type) * n_indices;
  CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes);
  CoglBuffer *buffer = COGL_BUFFER (index_buffer);
  CoglIndices *indices;
  CoglError *ignore_error = NULL;

  cogl_buffer_set_data (buffer,
                        0,
                        indices_data,
                        buffer_bytes,
                        &ignore_error);
  if (ignore_error)
    {
      cogl_error_free (ignore_error);
      cogl_object_unref (index_buffer);
      return NULL;
    }

  indices = cogl_indices_new_for_buffer (type, index_buffer, 0);
  cogl_object_unref (index_buffer);

  return indices;
}
Example #2
0
cg_indices_t *
cg_indices_new(cg_device_t *dev,
               cg_indices_type_t type,
               const void *indices_data,
               int n_indices)
{
    size_t buffer_bytes = sizeof_indices_type(type) * n_indices;
    cg_index_buffer_t *index_buffer =
        cg_index_buffer_new(dev, buffer_bytes);
    cg_buffer_t *buffer = CG_BUFFER(index_buffer);
    cg_indices_t *indices;
    cg_error_t *ignore_error = NULL;

    cg_buffer_set_data(buffer, 0, indices_data, buffer_bytes, &ignore_error);
    if (ignore_error) {
        cg_error_free(ignore_error);
        cg_object_unref(index_buffer);
        return NULL;
    }

    indices = cg_indices_new_for_buffer(type, index_buffer, 0);
    cg_object_unref(index_buffer);

    return indices;
}
Example #3
0
CoglIndices *
cogl_indices_new (CoglIndicesType type,
                  const void *indices_data,
                  int n_indices)
{
  size_t array_bytes = sizeof_indices_type (type) * n_indices;
  CoglIndexArray *array = cogl_index_array_new (array_bytes);
  CoglBuffer *buffer = COGL_BUFFER (array);
  CoglIndices *indices;

  cogl_buffer_set_data (buffer,
                        0,
                        indices_data,
                        array_bytes);

  indices = cogl_indices_new_for_array (type, array, 0);
  cogl_object_unref (array);

  return indices;
}
Example #4
0
CoglIndices *
cogl_indices_new (CoglIndicesType type,
                  const void *indices_data,
                  int n_indices)
{
  size_t buffer_bytes = sizeof_indices_type (type) * n_indices;
  CoglIndexBuffer *index_buffer = cogl_index_buffer_new (buffer_bytes);
  CoglBuffer *buffer = COGL_BUFFER (index_buffer);
  CoglIndices *indices;

  cogl_buffer_set_data (buffer,
                        0,
                        indices_data,
                        buffer_bytes);

  indices = cogl_indices_new_for_buffer (type, index_buffer, 0);
  cogl_object_unref (index_buffer);

  return indices;
}