Attribution
[llpp.git] / lablGL / glDraw.ml
blob6b012b7a717ebd8b1e11c6a108566bf342fef6a9
1 (* $Id: glDraw.ml,v 1.6 2007-04-13 01:17:50 garrigue Exp $ *)
3 open Gl
5 external color :
6 red:float -> green:float -> blue:float -> alpha:float -> unit
7 = "ml_glColor4d"
8 let color ?(alpha=1.) (red, green, blue : rgb) =
9 color ~red ~green ~blue ~alpha
11 external index : float -> unit = "ml_glIndexd"
13 external cull_face : face -> unit = "ml_glCullFace"
14 external edge_flag : bool -> unit = "ml_glEdgeFlag"
15 external front_face : [`cw|`ccw] -> unit = "ml_glFrontFace"
17 external line_width : float -> unit = "ml_glLineWidth"
19 external shade_model : [`flat|`smooth] -> unit = "ml_glShadeModel"
21 type shape =
22 [ `points | `lines | `polygon | `triangles | `quads | `line_strip
23 | `line_loop | `triangle_strip | `triangle_fan | `quad_strip ]
24 external begins : shape -> unit = "ml_glBegin"
25 external ends : unit -> unit = "ml_glEnd"
27 external normal : x:float -> y:float -> z:float -> unit
28 = "ml_glNormal3d"
29 let normal ?(x=0.) ?(y=0.) ?(z=0.) () = normal ~x ~y ~z
30 and normal3 (x,y,z) = normal ~x ~y ~z
32 external rect : point2 -> point2 -> unit = "ml_glRectd"
34 external vertex : x:float -> y:float -> ?z:float -> ?w:float -> unit -> unit
35 = "ml_glVertex"
36 let vertex2 (x,y : point2) = vertex ~x ~y ()
37 and vertex3 (x,y,z : point3) = vertex ~x ~y ~z ()
38 and vertex4 (x,y,z,w : point4) = vertex ~x ~y ~z ~w ()
40 external viewport : x:int -> y:int -> w:int -> h:int -> unit
41 = "ml_glViewport"