File: tesselate.ml

package info (click to toggle)
lablgl 1:1.05-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,444 kB
  • sloc: ansic: 8,270; ml: 6,118; tcl: 342; makefile: 294; xml: 84; perl: 12
file content (26 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(* $Id: tesselate.ml,v 1.1 2004-07-13 07:55:18 garrigue Exp $ *)

open Tk

let top = openTk()
let togl =
  Togl.create top ~width:500 ~height:500 ~rgba:true ~depth:true ~double:true

let () =
  Wm.title_set top "LablGL";
  pack ~fill:`Both [togl];
  Togl.display_func togl ~cb:
      begin fun () ->
        GlClear.color (0.0, 0.0, 0.0);
        GlClear.clear [`color];
        GlDraw.color (1.0, 1.0, 1.0);
        GlMat.mode `projection;
        GlMat.load_identity ();
        GlMat.ortho ~x:(-1.0,2.0) ~y:(-1.0,2.0) ~z:(-1.0,2.0);
        GluTess.tesselate
          [[0.,0.,0.;1.,0.,0.;1.,1.,0.;0.,1.,0.];
           [0.2,0.2,0.;0.2,0.8,0.;0.8,0.8,0.;0.8,0.2,0.]];
        Gl.flush ();
        Togl.swap_buffers togl
      end;
  mainLoop()