summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-05-31 14:54:42 +0200
committerYorhel <git@yorhel.nl>2010-05-31 14:54:42 +0200
commit963bcfe08d6fbc51e236a9b8dd5be506fe17cdb2 (patch)
tree19e6a00933b83648a593070dfd56197c349b708d
parent11911a6a5c2823eab167de05c117f96cb61e4589 (diff)
Cleaned up drawInfo
I now finally know how that orthographic view works, so let's put the code in my own "words".
-rw-r--r--util.ml13
1 files changed, 5 insertions, 8 deletions
diff --git a/util.ml b/util.ml
index 87d34de..4f16f5c 100644
--- a/util.ml
+++ b/util.ml
@@ -157,27 +157,24 @@ let drawInfo height width t =
GlMat.push ();
GlMat.load_identity ();
GluMat.ortho2d (0.0, width) (0.0, height);
- GlMat.scale ~x:1.0 ~y:(-1.0) ();
- GlMat.translate ~y:(-1.0 *. height) ();
GlMat.mode `modelview;
- (* draw character *)
GlMat.push ();
GlMat.load_identity ();
+ (* draw character *)
GlDraw.color (1.0, 1.0, 1.0);
(* FPS *)
- GlPix.raster_pos 0.0 13.0 ();
+ GlPix.raster_pos 0.0 (height -. 13.0) ();
String.iter
(fun c -> Glut.bitmapCharacter Glut.BITMAP_8_BY_13 (Char.code c))
(string_of_int !fps_cur);
(* time *)
- GlPix.raster_pos (width -. 48.0) 13.0 ();
+ GlPix.raster_pos (width -. 48.0) (height -. 13.0) ();
String.iter
(fun c -> Glut.bitmapCharacter Glut.BITMAP_8_BY_13 (Char.code c))
(Printf.sprintf "%6.2f" t);
- GlMat.pop ();
(* reset ortho *)
GlMat.mode `projection;
GlMat.pop ();
- GlMat.mode `modelview
-
+ GlMat.mode `modelview;
+ GlMat.pop ()