Don't rotate overlay if game is rotated.

This commit is contained in:
Themaister 2012-12-24 00:21:42 +01:00
parent 5400d9eaa4
commit 4c27922ab7
2 changed files with 6 additions and 6 deletions

View File

@ -617,18 +617,18 @@ void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate)
#endif
// Calculate projection.
math_matrix proj;
matrix_ortho(&proj, ortho->left, ortho->right,
matrix_ortho(&gl->mvp_no_rot, ortho->left, ortho->right,
ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
if (allow_rotate)
{
math_matrix rot;
matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f);
matrix_multiply(&proj, &rot, &proj);
matrix_multiply(&gl->mvp, &rot, &gl->mvp_no_rot);
}
else
gl->mvp = gl->mvp_no_rot;
gl->mvp = proj;
gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp);
}
@ -1865,7 +1865,7 @@ static void gl_render_overlay(gl_t *gl)
glEnable(GL_BLEND);
gl->coords.vertex = gl->overlay_vertex_coord;
gl->coords.tex_coord = gl->overlay_tex_coord;
gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp);
gl_shader_set_coords_func(gl, &gl->coords, &gl->mvp_no_rot);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_BLEND);

View File

@ -255,7 +255,7 @@ typedef struct gl
unsigned last_height[TEXTURES];
unsigned tex_w, tex_h;
GLfloat tex_coords[8];
math_matrix mvp;
math_matrix mvp, mvp_no_rot;
struct gl_coords coords;