Simplify
[llpp.git] / lablGL / glArray.ml
blob1733532e7c3461b276756f769d80bd4a22a4ec03
1 (* $Id: glArray.ml,v 1.6 2008-10-30 07:51:33 garrigue Exp $ *)
3 type kind = [`edge_flag | `texture_coord | `color | `index | `normal | `vertex ]
5 let check_static func f raw =
6 if not (Raw.static raw) then
7 invalid_arg ("GlArray." ^ func ^ " : buffer must be static");
8 f raw
10 external _edge_flag : [< `bitmap] Raw.t -> unit = "ml_glEdgeFlagPointer"
11 let edge_flag raw = check_static "edge_flag" _edge_flag raw
13 external _tex_coord :
14 [< `one | `two | `three | `four] ->
15 [< `short | `int | `float | `double] Raw.t -> unit
16 = "ml_glTexCoordPointer"
17 let tex_coord n = check_static "tex_coord" (_tex_coord n)
19 external _color :
20 [< `three | `four] ->
21 [< `byte | `ubyte | `short | `ushort | `int | `uint | `float | `double] Raw.t
22 -> unit
23 = "ml_glColorPointer"
24 let color n = check_static "color" (_color n)
26 external _index : [< `ubyte | `short | `int | `float | `double] Raw.t -> unit
27 = "ml_glIndexPointer"
28 let index raw = check_static "index" _index raw
30 external _normal : [< `byte | `short | `int | `float | `double] Raw.t -> unit
31 = "ml_glNormalPointer"
32 let normal raw = check_static "normal" _normal raw
34 external _vertex :
35 [< `two | `three | `four] -> [< `short | `int | `float | `double] Raw.t
36 -> unit
37 = "ml_glVertexPointer"
38 let vertex n = check_static "vertex" (_vertex n)
40 external enable : kind -> unit= "ml_glEnableClientState"
42 external disable : kind -> unit = "ml_glDisableClientState"
44 external element : int -> unit = "ml_glArrayElement"
46 external draw_arrays : GlDraw.shape -> first:int -> count:int -> unit
47 = "ml_glDrawArrays"
49 external draw_elements
50 : GlDraw.shape -> count:int -> [< `ubyte | `ushort | `uint] Raw.t -> unit
51 = "ml_glDrawElements"