render/gles2: transpose matrices before binding them

Setting glUniformMatrix3fv's transpose parameter to GL_TRUE is
not allowed for OpenGL ES 2.

This adds a wlr_matrix_transpose function.
This commit is contained in:
emersion 2018-03-19 20:21:02 +01:00
parent 6227da96b1
commit 6ecb0eefcb
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
3 changed files with 30 additions and 5 deletions

View file

@ -33,6 +33,15 @@ void wlr_matrix_multiply(float mat[static 9], const float a[static 9],
memcpy(mat, product, sizeof(product));
}
void wlr_matrix_transpose(float mat[static 9], const float a[static 9]) {
float transposition[9] = {
a[0], a[3], a[6],
a[1], a[4], a[7],
a[2], a[5], a[8],
};
memcpy(mat, transposition, sizeof(transposition));
}
void wlr_matrix_translate(float mat[static 9], float x, float y) {
float translate[9] = {
1.0f, 0.0f, x,