summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/engine/engine.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/engine/engine.c b/src/main/engine/engine.c
index 92222bb..ab595ac 100644
--- a/src/main/engine/engine.c
+++ b/src/main/engine/engine.c
@@ -185,8 +185,15 @@ engine_on_ui_expose(UIEventResize *er)
/* Objects in the rendering area must maintain the proportions. So, let's enable Ortho */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- float aspect = (float)er->width / (float)er->height;
- glOrtho(-aspect, aspect, -1, 1, -1, 1);
+
+ float aspect;
+ if (er->width >= er->height) {
+ aspect = (float)er->width / (float)er->height;
+ glOrtho(-aspect, aspect, -1, 1, -1, 1);
+ } else {
+ aspect = (float)er->height / (float)er->width;
+ glOrtho(-1, 1, -aspect, aspect, -1, 1);
+ }
/* Returns to the model view */
glMatrixMode(GL_MODELVIEW);