mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
test-cogl-tex-polygon: Actually use the material it creates
test-cogl-tex-polygon creates a separate material so that it can set the texture filters. However in the paint functions that use cogl_polygon it was calling cogl_set_source_texture which replaces the material and ends up always using GL_LINEAR. This patch makes the paint functions assume the correct source is set up instead of trying to select a new source.
This commit is contained in:
parent
53cf25ef11
commit
fdf608af4c
@ -79,8 +79,7 @@ struct _TestCoglboxPrivate
|
||||
*--------------------------------------------------*/
|
||||
|
||||
static void
|
||||
test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
gfloat x1,
|
||||
test_coglbox_fade_texture (gfloat x1,
|
||||
gfloat y1,
|
||||
gfloat x2,
|
||||
gfloat y2,
|
||||
@ -123,14 +122,12 @@ test_coglbox_fade_texture (CoglHandle tex_id,
|
||||
cogl_color_premultiply (&(vertices[i].color));
|
||||
}
|
||||
|
||||
cogl_set_source_texture (tex_id);
|
||||
cogl_polygon (vertices, 4, TRUE);
|
||||
|
||||
cogl_set_source_color4ub (255, 255, 255, 255);
|
||||
}
|
||||
|
||||
static void
|
||||
test_coglbox_triangle_texture (CoglHandle tex_id,
|
||||
test_coglbox_triangle_texture (int tex_width,
|
||||
int tex_height,
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
gfloat tx1,
|
||||
@ -141,8 +138,6 @@ test_coglbox_triangle_texture (CoglHandle tex_id,
|
||||
gfloat ty3)
|
||||
{
|
||||
CoglTextureVertex vertices[3];
|
||||
int tex_width = cogl_texture_get_width (tex_id);
|
||||
int tex_height = cogl_texture_get_height (tex_id);
|
||||
|
||||
vertices[0].x = x + tx1 * tex_width;
|
||||
vertices[0].y = y + ty1 * tex_height;
|
||||
@ -162,7 +157,6 @@ test_coglbox_triangle_texture (CoglHandle tex_id,
|
||||
vertices[2].tx = tx3;
|
||||
vertices[2].ty = ty3;
|
||||
|
||||
cogl_set_source_texture (tex_id);
|
||||
cogl_polygon (vertices, 3, FALSE);
|
||||
}
|
||||
|
||||
@ -195,8 +189,7 @@ test_coglbox_paint (ClutterActor *self)
|
||||
cogl_set_source (material);
|
||||
cogl_rectangle_with_texture_coords (0, 0, tex_width, tex_height,
|
||||
0, 0, 1, 1);
|
||||
test_coglbox_fade_texture (tex_handle,
|
||||
0, tex_height,
|
||||
test_coglbox_fade_texture (0, tex_height,
|
||||
tex_width, (tex_height * 3 / 2),
|
||||
0.0, 1.0,
|
||||
1.0, 0.5);
|
||||
@ -209,12 +202,12 @@ test_coglbox_paint (ClutterActor *self)
|
||||
cogl_translate (-tex_width / 2 - 10, 0, 0);
|
||||
|
||||
/* Draw the texture split into two triangles */
|
||||
test_coglbox_triangle_texture (tex_handle,
|
||||
test_coglbox_triangle_texture (tex_width, tex_height,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 1,
|
||||
1, 1);
|
||||
test_coglbox_triangle_texture (tex_handle,
|
||||
test_coglbox_triangle_texture (tex_width, tex_height,
|
||||
20, 0,
|
||||
0, 0,
|
||||
1, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user