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