Method

CoglFramebufferdraw_multitextured_rectangle

Declaration [src]

void
cogl_framebuffer_draw_multitextured_rectangle (
  CoglFramebuffer* framebuffer,
  CoglPipeline* pipeline,
  float x_1,
  float y_1,
  float x_2,
  float y_2,
  const float* tex_coords,
  int tex_coords_len
)

Description [src]

Draws a textured rectangle to framebuffer with the given pipeline state with the top left corner positioned at (x_1, y_1) and the bottom right corner positioned at (x_2, y_2). As a pipeline may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the pipeline.

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

This is a high level drawing api that can handle any kind of CoglMetaTexture texture for the first layer such as CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as CoglTexture2D.

This api can not currently handle multiple high-level meta texture layers. The first layer may be a high level meta texture such as CoglTexture2DSliced but all other layers much be low level textures such as CoglTexture2D.

The top left texture coordinate for layer 0 of any pipeline will be (tex_coords[0], tex_coords[1]) and the bottom right coordinate will be (tex_coords[2], tex_coords[3]). The coordinates for layer 1 would be (tex_coords[4], tex_coords[5]) (tex_coords[6], tex_coords[7]) and so on…

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.

The first pair of coordinates are for the first layer (with the smallest layer index) and if you supply less texture coordinates than there are layers in the current source material then default texture coordinates (0.0, 0.0, 1.0, 1.0) are generated.

Stability:Unstable
Available since:1.10

Parameters

pipeline CoglPipeline
 

A CoglPipeline state object.

 The data is owned by the caller of the function.
x_1 float
 

X coordinate upper left on screen.

y_1 float
 

Y coordinate upper left on screen.

x_2 float
 

X coordinate lower right on screen.

y_2 float
 

Y coordinate lower right on screen.

tex_coords An array of float
 

An array containing groups of 4 float values: [s_1, t_1, s_2, t_2] that are interpreted as two texture coordinates; one for the top left texel, and one for the bottom right texel. Each value should be between 0.0 and 1.0, where the coordinate (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the bottom right.

 The data is owned by the caller of the function.
tex_coords_len int
 

The length of the tex_coords array. (For one layer and one group of texture coordinates, this would be 4)