draw_indexed_attributes


Description:

[ Deprecated ( since = "1.16" ) ]
public void draw_indexed_attributes (Pipeline pipeline, VerticesMode mode, int first_vertex, int n_vertices, Indices indices, Attribute attributes, int n_attributes)

Warning: draw_indexed_attributes is deprecated.

Behaves the same as draw_attributes except that instead of reading vertex data sequentially from the specified attributes the indices provide an indirection for how the data should be indexed allowing a random access order to be specified.

Note:

Use Primitive<!-- -->s and draw instead

For example an indices array of [0, 1, 2, 0, 2, 3] could be used used to draw two triangles (mode = cogl_vertices_mode_triangles + n_vertices = 6) but only provide attribute data for the 4 corners of a rectangle. When the GPU needs to read in each of the 6 vertices it will read the indices array for each vertex in sequence and use the index to look up the vertex attribute data. So here you can see that first and fourth vertex will point to the same data and third and fifth vertex will also point to shared data.

Drawing with indices can be a good way of minimizing the size of a mesh by allowing you to avoid data for duplicate vertices because multiple entries in the index array can refer back to a single shared vertex.

<note>The indices array must be at least as long as first_vertex + n_vertices otherwise the GPU will overrun the indices array when looking up vertex data.</note>

Since it's very common to want to draw a run of rectangles using indices to avoid duplicating vertex data you can use get_rectangle_indices to get a set of indices that can be shared.

This drawing api doesn't support high-level meta texture types such as Texture2DSliced so it is the user's responsibility to ensure that only low-level textures that can be directly sampled by a GPU such as Texture2D, TextureRectangle or Texture3D are associated with layers of the given pipeline.

<note>This api doesn't support any of the legacy global state options such as cogl_set_depth_test_enabled, cogl_set_backface_culling_enabled or cogl_program_use</note>

Parameters:

this

A destination Framebuffer

pipeline

A Pipeline state object

mode

The VerticesMode defining the topology of vertices

first_vertex

The vertex offset within the given attributes to draw from

n_vertices

The number of vertices to draw from the given attributes

indices

The array of indices used by the GPU to lookup attribute data for each vertex.

attributes

An array of pointers to Attribute<-- -->s defining vertex geometry

n_attributes

The number of attributes in the attributes array.