diff options
author | Yorhel <git@yorhel.nl> | 2010-05-31 14:54:42 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-05-31 14:54:42 +0200 |
commit | 963bcfe08d6fbc51e236a9b8dd5be506fe17cdb2 (patch) | |
tree | 19e6a00933b83648a593070dfd56197c349b708d | |
parent | 11911a6a5c2823eab167de05c117f96cb61e4589 (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.ml | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -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 () |