Ubuntu CI: make apt update before apt install
[llpp.git] / glutils.ml
bloba49f879f26dca47feacf05f98d8bfcb485e562d4
1 let vraw = Raw.create_static `float ~len:8
3 let filledrect2 x0 y0 x1 y1 x2 y2 x3 y3 =
4 Raw.sets_float vraw ~pos:0 [| x0; y0; x1; y1; x2; y2; x3; y3 |];
5 GlArray.vertex `two vraw;
6 GlArray.draw_arrays `triangle_strip ~first:0 ~count:4
8 let filledrect1 x0 y0 x1 y1 = filledrect2 x0 y0 x0 y1 x1 y0 x1 y1
10 let filledrect x0 y0 x1 y1 =
11 GlArray.disable `texture_coord;
12 filledrect1 x0 y0 x1 y1;
13 GlArray.enable `texture_coord
15 let linerect x0 y0 x1 y1 =
16 GlArray.disable `texture_coord;
17 Raw.sets_float vraw ~pos:0 [| x0; y0; x0; y1; x1; y1; x1; y0 |];
18 GlArray.vertex `two vraw;
19 GlArray.draw_arrays `line_loop ~first:0 ~count:4;
20 GlArray.enable `texture_coord
22 let drawstring size x y s =
23 Gl.enable `blend;
24 Gl.enable `texture_2d;
25 GlFunc.blend_func ~src:`src_alpha ~dst:`one_minus_src_alpha;
26 ignore (Ffi.drawstr size x y s);
27 Gl.disable `blend;
28 Gl.disable `texture_2d
30 let drawstringf size x y = Printf.kprintf (drawstring size (x+1) (y+size+1))
31 let redisplay = ref false
32 let postRedisplay who =
33 Utils.vlog "redisplay for [%S]" who;
34 redisplay := true