mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
util/matrix: Rotate around (.5, .5) with wlr_matrix_transform
Before we would rotate around 0,0 which means that the content needed to be scaled to -1, 1 to be transformed properly when we're usually working in the 0, 1 range. Switch it around. These matrices were precomputed by simply adding a -.5 -.5 translate and back again with old transform in between.
This commit is contained in:
parent
c9d6339b60
commit
3a4bc44688
2 changed files with 8 additions and 12 deletions
|
|
@ -139,7 +139,6 @@ static void set_tex_matrix(GLint loc, enum wl_output_transform trans,
|
|||
wlr_matrix_identity(tex_matrix);
|
||||
wlr_matrix_translate(tex_matrix, box->x, box->y);
|
||||
wlr_matrix_scale(tex_matrix, box->width, box->height);
|
||||
wlr_matrix_translate(tex_matrix, .5, .5);
|
||||
|
||||
// since textures have a different origin point we have to transform
|
||||
// differently if we are rotating
|
||||
|
|
@ -148,7 +147,6 @@ static void set_tex_matrix(GLint loc, enum wl_output_transform trans,
|
|||
} else {
|
||||
wlr_matrix_transform(tex_matrix, trans);
|
||||
}
|
||||
wlr_matrix_translate(tex_matrix, -.5, -.5);
|
||||
|
||||
glUniformMatrix3fv(loc, 1, GL_FALSE, tex_matrix);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue