Cogl.Framebuffer.prototype.draw_textured_rectangles

function draw_textured_rectangles(pipeline: Cogl.Pipeline, coordinates: Array(Number(gfloat)), n_rectangles: Number(guint)): void {
    // Gjs wrapper for cogl_framebuffer_draw_textured_rectangles()
}
  

Draws a series of rectangles to framebuffer with the given pipeline state in the same way that Cogl.Framebuffer.prototype.draw_textured_rectangle does.

<note>The position is the position before the rectangle has been transformed by the model-view matrix and the projection matrix.</note>

This is a high level drawing api that can handle any kind of Cogl.MetaTexture texture such as Cogl.Texture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as Cogl.Primitive.prototype.draw which only support low level texture types that are directly supported by GPUs such as Cogl.Texture2D.

The top left corner of the first rectangle is positioned at (coordinates[0], coordinates[1]) and the bottom right corner is positioned at (coordinates[2], coordinates[3]). The top left texture coordinate is (coordinates[4], coordinates[5]) and the bottom right texture coordinate is (coordinates[6], coordinates[7]). The coordinates for subsequent rectangles are defined similarly by the subsequent coordinates.

As a general rule for better performance its recommended to use this this API instead of calling Cogl.Framebuffer.prototype.draw_textured_rectangle separately for multiple rectangles if all of the rectangles will be drawn together with the same pipeline state.

The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, tex_coords[3]=1.

<note>Even if you have associated a Cogl.TextureRectangle texture which normally implies working with non-normalized texture coordinates this api should still be passed normalized texture coordinates.</note>

Since 1.10

pipeline

A Cogl.Pipeline state object

coordinates

an array containing groups of 8 float values: [x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2] that have the same meaning as the arguments for Cogl.Framebuffer.prototype.draw_textured_rectangle.

n_rectangles

number of rectangles to coordinates to draw