[from now] 2012/11/26 16:40:32

diff --git a/src/gl_api.ml b/src/gl_api.ml
index 776095c..c9da188 100644
--- a/src/gl_api.ml
+++ b/src/gl_api.ml
@@ -8,644 +8,1127 @@
    @author derui
 *)

-open Gl_enum
-
-(** Variants that cheap size of data array with data types.
-*)
-type array_type = [
-| `AByte of char array
-| `AUByte of char array
-| `AShort of int array
-| `AUShort of int array
-| `AInt of int array
-| `AUInt of int64 array
-| `AFloat of float array
-| `ADouble of float array
-]
-
-(** Variants that big size of data array with data types *)
-type big_array_type = [
-| `BAByte of (char, Bigarray.int8_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BAShort of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BAUShort of (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BAUInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-| `BADouble of (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
-]
-
-(** execute a list of display lists.
-    the list that is treated array specified with {!big_array_type} which combine
-    big_array_type the type of array value with array that value of type is it.
-    This function can't apply {!`BADouble}.
-
-    Note: Variant of UByte2/3/4 has to have size to multiply first argument with 2/3/4.
-
-    @param size size of array
-    @param lists executeing list
-*)
-external glCallLists : int -> [< `BAByte of (char, Bigarray.int8_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAShort of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAUShort of (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAUInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAUByte2 of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAUByte3 of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              | `BAUByte4 of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-                              ]
-  -> unit = "gl_api_glCallLists"
-
-(** define an array of vertex data.
-
-    @param size the number of coodinates per vertex. Must be 2,3, or 4.
-    @param stride the byte offset between consecutive vertices.
-    @param pointer vertex array
-*)
-external glVertexPointer : int -> int ->
-  [< `BAShoft of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BADouble of (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit
-    = "gl_api_glVertexPointer"
-
-(** define an array of normals
-
-    @param stride the byte offset between consecutive vertices.
-    @param pointer normal array
-*)
-external glNormalPointer : int ->
-  [< `BAByte of (char, Bigarray.int8_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAShoft of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BADouble of (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit
-    = "gl_api_glNormalPointer"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glClearIndex.xml}
+    manual pages on opengl.org}
+*)
+external glClearIndex : float -> unit = "gl_auto_glClearIndex"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glClearColor.xml}
+    manual pages on opengl.org}
+*)
+external glClearColor : red:float -> green:float -> blue:float -> alpha:float -> unit
+  = "gl_auto_glClearColor"

-(** define an array of colors.
+module Clear = Enums.Clear

-    @param size the number of components per color. Must be 3, or 4.
-    @param stride the byte offset between consecutive vertices.
-    @param pointer vertex array
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glClear.xml}
+    manual pages on opengl.org}
 *)
-external glColorPointer : int -> int -> big_array_type -> unit
-  = "gl_api_glColorPointer"
+external glClear : Clear.clear_mask list -> unit = "gl_auto_glClear"

-(** define an array of color indexes
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glIndexMask.xml}
+    manual pages on opengl.org}
+*)
+external glIndexMask : int -> unit = "gl_auto_glIndexMask"

-    @param stride the byte offset between consecutive color indexes.
-    @param pointer color index array
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml}
+    manual pages on opengl.org}
 *)
-external glIndexPointer : int ->
-  [< `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAShoft of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BADouble of (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit
-    = "gl_api_glIndexPointer"
+external glColorMask : red:bool -> green:bool -> blue:bool -> alpha:bool -> unit
+  = "gl_auto_glColorMask"

-(** define an array of texture coordinates
+module Func = Enums.Func

-    @param size the number of coordinates per array element.Must be 1,2,3,or 4
-    @param stride the byte offset between consecutive texture coordinate sets
-    @param pointer texture coordinate array
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glNormalPointer.xml}
+    manual pages on opengl.org}
 *)
-external glTexCoordPointer : int ->
-  [< `BAShoft of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BADouble of (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit
-    = "gl_api_glTexCoordPointer"
+external glAlphaFunc : func:Func.compare_func -> clamp:float -> unit = "gl_auto_glAlphaFunc"

-(** define an array of edge flags.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml}
+    manual pages on opengl.org}
+*)
+external glBlendFunc : src:Func.blend_src_func -> dest:Func.blend_dst_func -> unit = "gl_auto_glBlendFunc"

-    Note: the flags in given array must be either 1 if true or 0 if false.
+module Op = Enums.Op
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLogicOp.xml}
+    manual pages on opengl.org}
+*)
+external glLogicOp : Op.logic_opcode -> unit = "gl_auto_glLogicOp"

-    @param stride the byte offset between consecutive edge flags.
-    @param array of boolean edge flags
+module CullFace = Enums.CullFace
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCullFace.xml}
+    manual pages on opengl.org}
 *)
-external glEdgeFlagPointer : int -> int ->
-  [< `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t]
-  -> unit
-  = "gl_api_glEdgeFlagPointer"
+external glCullFace : CullFace.cull_face_mode -> unit = "gl_auto_glCullFace"

-(** Return the data of specified pointer.
+module FrontFace = Enums.FrontFace
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glFrontFace.xml}
+    manual pages on opengl.org}
+*)
+external glFrontFace : FrontFace.ccw -> unit = "gl_auto_glFrontFace"

-    @param pname specifies the array or buffer pointer to be returned.
-    @return data of specified array or buffer.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPointSize.xml}
+    manual pages on opengl.org}
 *)
-external glGetPointerv : glenum ->
-  [< big_array_type
-  | `BAUByte2 of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUByte3 of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUByte4 of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ]
-  = "gl_api_glGetPointerv"
+external glPointSize : float -> unit = "gl_auto_glPointSize"

-(** render primitives from array data.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glNormalPointer.xml}
+    manual pages on opengl.org}
+*)
+external glLineWidth : float -> unit = "gl_auto_glLineWidth"

-    @param mode kind of primitives to render
-    @param count number of elements to be rendered
-    @param indices indices to be rendered
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glNormalPointer.xml}
+    manual pages on opengl.org}
 *)
-external glDrawElements : glenum -> int ->
-  [< `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUShort of (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit = "gl_api_glDrawElements"
+external glLineStipple : factor:int -> pattern:int -> unit = "gl_auto_glLineStipple"

-(** Return light source parameter values.
+module Poly = Enums.Poly
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPolygonMode.xml}
+    manual pages on opengl.org}
+*)
+external glPolygonMode : face:Poly.cull_face_mode -> mode:Poly.poly_face_mode -> unit
+  = "gl_auto_glPolygonMode"

-    @param light light source
-    @param pname light source parameter
-    @return requested data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml}
+    manual pages on opengl.org}
 *)
-external glGetLightfv : glenum -> glenum -> float array = "gl_api_glGetLightfv"
-external glGetLightiv : glenum -> glenum -> int array = "gl_api_glGetLightiv"
+external glPolygonOffset : factor:float -> units:float -> unit
+  = "gl_auto_glPolygonOffset"

-(** Return material parameters
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPolygonStipple.xml}
+    manual pages on opengl.org}
+*)
+external glPolygonStipple : (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+  = "gl_auto_glPolygonStipple"

-    @param face which of the two materials is being queried
-    @param pname material parameter
-    @return requested data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetPolygonStipple.xml}
+    manual pages on opengl.org}
 *)
-external glGetMaterialfv : glenum -> glenum -> float array = "gl_api_glGetMaterialfv"
-external glGetMaterialiv : glenum -> glenum -> int array = "gl_api_glGetMaterialiv"
+external glGetPolygonStipple : unit -> (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
+  = "gl_auto_glGetPolygonStipple"

-(** read a block of pixels from the frame buffer
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEdgeFlag.xml}
+    manual pages on opengl.org}
+*)
+external glEdgeFlag : bool -> unit = "gl_auto_glEdgeFlag"

-    @param x the window coordinate of X where is the lower left corder of pixels.
-    @param y the window coordinate of Y where is the lower left corder of pixels.
-    @param width the dimensions of width of the pixel rectangle
-    @param height the dimensions of height of the pixel rectangle
-    @param format format of the pixel data
-    @param type data type of the pixel data
-    @return pixel data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEdgeFlagv.xml}
+    manual pages on opengl.org}
 *)
-external glReadPixels : int -> int -> int -> int ->
-  glenum -> glenum -> array_type = "gl_api_glReadPixels_native"
-    "gl_api_glReadPixels_bytecode"
+external glEdgeFlagv: unit -> bool = "gl_auto_glEdgeFlagv"

-(** write a block of pixels to the frame buffer.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml}
+    manual pages on opengl.org}
+*)
+external glScissor : x:int -> y:int -> width:int -> height:int -> unit
+  = "gl_auto_glScissor"
+
+module ClipPlane = Enums.ClipPlane

-    @param width the dimensions of width of the pixel rectangle to be written.
-    @param height the dimensions of height of the pixel rectangle to be written.
-    @param format format of the pixel data
-    @param type data type for {!data}
-    @param data pixel data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glClipPlane.xml}
+    manual pages on opengl.org}
 *)
-external glDrawPixels : int -> int -> glenum -> glenum -> big_array_type = "gl_api_glDrawPixels"
+external glClipPlane : plane:ClipPlane.clip_plane ->
+  equaltion:(float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+    = "gl_auto_glClipPlane"

-(**
-   Return texture coodinate generation parameters.
+type clip_plane_i = GL_CILP_PLANE of int

-   Note: this function do not apply glenum mapped GL_TEXTURE_GEN_MODE.
-         If you need that value, call {!glGetTexGenv}.
+external glClipPlanei : plane:clip_plane_i ->
+  equaltion:(float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+    = "gl_auto_glClipPlanei"

-   @param coord texture coordinate
-   @param pname type of value to be returned
-   @return requested data.
+let glClipPlanei ~plane ~equaltion =
+  match plane with
+  | GL_CLIP_PLANE i -> glClipPlanei ~plane:i ~equaltion
+
+external glGetClipPlane : ClipPlane.clip_plane ->
+  (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
+  = "gl_auto_glGetClipPlane"
+
+type aux_buffer = GL_AUX of int
+module Buffer = Enums.Buffer
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDrawBuffer.xml}
+    manual pages on opengl.org}
 *)
-external glGetTexGendv : glenum -> glenum -> float array = "gl_api_glGetTexGendv"
-external glGetTexGenfv : glenum -> glenum -> float array = "gl_api_glGetTexGenfv"
-external glGetTexGeniv : glenum -> glenum -> int array = "gl_api_glGetTexGeniv"
+external glDrawBuffer : Buffer.draw_buffer_mode -> unit = "gl_auto_glDrawBuffer"
+external glDrawBuffer_aux : aux_buffer -> unit = "gl_auto_glDrawBuffer_aux"

-(**
-   Return texture coodinate generation parameters.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glReadBuffer.xml}
+    manual pages on opengl.org}
+*)
+external glReadBuffer : Buffer.read_buffer_mode -> unit = "gl_auto_glReadBuffer"
+external glReadBuffer_aux : aux_buffer -> unit = "gl_auto_glReadBuffer_aux"

-   @param coord texture coordinate
-   @return texture generation function
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEnable.xml}
+    manual pages on opengl.org}
 *)
-external glGetTexGenv : glenum -> glenum = "gl_api_glGetTexGenv"
+external glEnable : Enable.enable_mode -> unit = "gl_auto_glEnable"
+external glDisable : Enable.enable_mode -> unit = "gl_auto_glDisable"
+external glIsEnabled : Enable.enable_mode -> bool = "gl_auto_glIsEnabled"

-(**
-   Return texture environment parameters.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEnableClientState.xml}
+    manual pages on opengl.org}
+*)
+external glEnableClientState : Enable.client_state_mode -> unit
+  = "gl_auto_glEnableClientState"
+external glDisableClientState : Enable.client_state_mode -> unit
+  = "gl_auto_glDisableClientState"
+
+module Get = Enums.Get
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGet.xml}
+    manual pages on opengl.org}
+*)
+external glGetBoolean1 : Get.get_boolean_1 -> bool = "gl_auto_glGetBoolean1"
+external glGetBoolean4 : Get.get_boolean_4 -> bool * bool * bool * bool = "gl_auto_glGetBoolean4"

-   @param target texture environment
-   @param pname texture enviromnent parameter
-   @return requested data
+external glGetFloat1: Get.get_value_1 -> float = "gl_auto_glGetFloat1"
+external glGetFloat2: Get.get_value_2 -> float = "gl_auto_glGetFloat2"
+(* For GL_CURRENT_NORMAL *)
+external glGetFloat3: unit -> float = "gl_auto_glGetFloat3"
+external glGetFloat4: Get.get_value_4 -> float = "gl_auto_glGetFloat4"
+
+external glGetInteger1: Get.get_value_1 -> int = "gl_auto_glGetInteger1"
+external glGetInteger2: Get.get_value_2 -> int = "gl_auto_glGetInteger2"
+(* For GL_CURRENT_NORMAL *)
+external glGetInteger3: unit -> int = "gl_auto_glGetInteger3"
+external glGetInteger4: Get.get_value_4 -> int = "gl_auto_glGetInteger4"
+
+external glGetMatrix : Get.get_matrix -> float array = "gl_auto_glGetMatrix"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPushAttrib.xml}
+    manual pages on opengl.org}
 *)
-external glGetTexEnvfv : glenum -> glenum -> float array = "gl_api_glGetTexEnvfv"
-external glGetTexEnviv : glenum -> glenum -> int array = "gl_api_glGetTexEnviv"
+module Attrib = Enums.Attrib
+external glPushAttrib : Attrib.attrib_mask -> unit = "gl_auto_glPushAttrib"
+external glPopAttrib : unit -> unit = "gl_auto_glPopAttrib"

-(**
-   Return texture parameter values for a specific level of detail

-   @param target texture
-   @param level level-of-detail. Level n is the nth mipmap reduction image.
-   @param pname name of texture parameter
-   @return requested data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPushClientAttrib.xml}
+    manual pages on opengl.org}
 *)
-external glGetTexLevelParameterfv: glenum -> int -> glenum -> float = "gl_api_glGetTexLevelParameterfv"
-external glGetTexLevelParameteriv: glenum -> int -> glenum -> int = "gl_api_glGetTexLevelParameteriv"
+external glPushClientAttrib : Attrib.client_attrib_mask -> unit
+  = "gl_auto_glPushClientAttrib"
+external glPopClientAttrib : unit -> unit = "gl_auto_glPopClientAttrib"

-(**
-   Specify a one dimensional texture image.
-   Noted that the parameter of {!width} has limitation of size which must be
-   2^n + 2(for some interger n) if GL version does not support non-power-of-two.
-
-   @param target target texture.
-   @param level Specifies the level-of-detail number
-   @param internalFormat Specifies the number of color components
-   @param width Specifies the width of the texture image.
-   @param border the width of border. Must be 1 or 0.
-   @param format Specifies the format of the pixel data
-   @param data data type and texture image data
-*)
-external glTexImage1D: glenum -> int -> int -> int -> int ->
-  glenum -> big_array_type -> unit = "gl_api_glTexImage1D_native"
-    "gl_api_glTexImage1D_bytecode"
+module Render = Enums.Render
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glRenderMode.xml}
+    manual pages on opengl.org}
+*)
+external glRenderMode : Render.render_mode -> int = "gl_auto_glRenderMode"

-(**
-   Specify a two dimensional texture image.
-   Noted that the parameter of {!width} has limitation of size which must be
-   2^n + 2(for some interger n) if GL version does not support non-power-of-two.
-
-   @param target target texture.
-   @param level Specifies the level-of-detail number
-   @param internalFormat Specifies the number of color components
-   @param width Specifies the width of the texture image.
-   @param height Specifies the height of the texture image.
-   @param border the width of border. Must be 1 or 0.
-   @param format Specifies the format of the pixel data
-   @param data data type and texture image data
-*)
-external glTexImage2D: glenum -> int -> int -> int -> int -> int ->
-  glenum -> big_array_type -> unit = "gl_api_glTexImage2D_native"
-    "gl_api_glTexImage2D_bytecode"
+module Error = Enums.Error
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetError.xml}
+    manual pages on opengl.org}
+*)
+external glGetError : unit -> Error.get_error = "gl_auto_glGetError"

-(**
-   Specify a three dimensional texture image.
-   Noted that the parameter of {!width} has limitation of size which must be
-   2^n + 2(for some interger n) if GL version does not support non-power-of-two.
-
-   @param target target texture.
-   @param level Specifies the level-of-detail number
-   @param internalFormat Specifies the number of color components
-   @param width Specifies the width of the texture image.
-   @param height Specifies the height of the texture image.
-   @param depth Specifies the depth of the texture image.
-   @param border the width of border. Must be 1 or 0.
-   @param format Specifies the format of the pixel data
-   @param data data type and texture image data
-*)
-external glTexImage3D: glenum -> int -> int -> int -> int -> int -> int ->
-  glenum -> big_array_type -> unit = "gl_api_glTexImage3D_native"
-    "gl_api_glTexImage3D_bytecode"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetString.xml}
+    manual pages on opengl.org}
+*)
+external glGetString : Get.get_string -> string = "gl_auto_glGetString"

-(**
-   Return a texture image.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glFinish.xml}
+    manual pages on opengl.org}
+*)
+external glFinish : unit -> unit = "gl_auto_glFinish"

-   @param target Specifies which texture is to be obtained
-   @param level Specifies the level-of-detail number of the desired image.
-   @param format Specifies a pixel format for the returned data.
-   @param data texture data stored into given already allocated
-   bigarray that size is to need for it
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glFlush.xml}
+    manual pages on opengl.org}
 *)
-external glGetTexImage: glenum -> int -> glenum ->
-  big_array_type -> unit = "gl_api_glGetTexImage"
+external glFlush : unit -> unit = "gl_auto_glFlush"

-(**
-   specify a one-dimensional texture subimage.
+module Hint = Enums.Hint
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glHint.xml}
+    manual pages on opengl.org}
+*)
+external glHint : target:Hint.hint_target -> mode:Hint.hint_mode -> unit
+  = "gl_auto_glHint"

-   @param target Specifies the target texture. Must be GL_TEXTURE_1D
-   @param level Specifies the leve-of-detail.
-   @param xoffset Specifies a texel offset in the xdirection within the texture array
-   @param width Specifies the width of the texture subimage
-   @param format Specifies the format of the pixel data.
-   @param data texture subimage type and texture subimage type.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glHint.xml}
+    manual pages on opengl.org}
 *)
-external glTexSubImage1D: glenum -> int -> int -> int ->
-  glenum -> big_array_type -> unit = "gl_api_glTexSubImage1D_native"
-    "gl_api_glTexSubImage1D_bytecode"
+external glClearDepth : float -> unit = "gl_auto_glClearDepth"

-(**
-   specify a two-dimensional texture subimage.
-
-   @param target Specifies the target texture. Must be GL_TEXTURE_1D
-   @param level Specifies the leve-of-detail.
-   @param xoffset Specifies a texel offset in the xdirection within the texture array
-   @param yoffset Specifies a texel offset in the ydirection within the texture array
-   @param width Specifies the width of the texture subimage
-   @param height Specifies the height of the texture subimage
-   @param format Specifies the format of the pixel data.
-   @param data texture subimage type and texture subimage type.
-*)
-external glTexSubImage2D: glenum -> int -> int -> int -> int -> int ->
-  glenum -> big_array_type -> unit = "gl_api_glTexSubImage2D_native"
-    "gl_api_glTexSubImage2D_bytecode"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDepthFunc.xml}
+    manual pages on opengl.org}
+*)
+external glDepthFunc : Func.compare_func -> unit = "gl_auto_glDepthFunc"

-(**
-   specify a three-dimensional texture subimage.
-
-   @param target Specifies the target texture. Must be GL_TEXTURE_1D
-   @param level Specifies the leve-of-detail.
-   @param xoffset Specifies a texel offset in the xdirection within the texture array
-   @param yoffset Specifies a texel offset in the ydirection within the texture array
-   @param zoffset Specifies a texel offset in the zdirection within the texture array
-   @param width Specifies the width of the texture subimage
-   @param height Specifies the height of the texture subimage
-   @param depth Specifies the depth of the texture subimage
-   @param format Specifies the format of the pixel data.
-   @param data texture subimage type and texture subimage type.
-*)
-external glTexSubImage3D: glenum -> int -> int -> int -> int -> int -> int -> int ->
-  glenum -> big_array_type -> unit = "gl_api_glTexSubImage3D_native"
-    "gl_api_glTexSubImage3D_bytecode"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDepthRange.xml}
+    manual pages on opengl.org}
+*)
+external glDepthRange : near:float -> far:float -> unit = "gl_auto_glDepthRange"

-(**
-   Return evaluator parameters
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glClearAccum.xml}
+    manual pages on opengl.org}
+*)
+external glClearAccum : red:float -> green:float -> blue:float -> alpha:float -> unit
+  = "gl_auto_external"

-   @param target Specifies the symbolic name of a map
-   @param query Specifies which parameter to return
-   @return requested data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glAccum.xml}
+    manual pages on opengl.org}
 *)
-external glGetMapdv: glenum -> glenum -> float array = "gl_api_glGetMapdv"
-external glGetMapfv: glenum -> glenum -> float array = "gl_api_glGetMapfv"
-external glGetMapiv: glenum -> glenum -> int array = "gl_api_glGetMapiv"
+external glAccum : op:Accum.accum_op -> value:float -> unit = "gl_auto_glAccum"

-(**
-   Render primitives fro array data
+module Matrix = Enums.Matrix
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMatrixMode.xml}
+    manual pages on opengl.org}
+*)
+external glMatrixMode : Matrix.matrix_mode -> unit = "gl_auto_glMatrixMode"

-   @param mode kind of primitives to render
-   @param start minimum array index contained in {!indices}
-   @param end maxmum array index contained in {!indices}
-   @param count the number of elements to be rendered
-   @param indices indices to render and type
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml}
+    manual pages on opengl.org}
 *)
-external glDrawRangeElements: glenum -> int -> int -> int ->
-  [< `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUShort of (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit = "gl_api_glDrawRangeElements"
+external glOrtho : left:float -> right:float -> bottom:float ->
+  top:float -> near:float -> far:float -> unit
+    = "gl_auto_glOrtho_bytecode" "gl_auto_glOrtho"

-(**
-   Define a color lookup table.
-
-   @param target type of color lookup table.
-   @param internalformat internal format of the color table
-   @param width The number of entries in the color lookup table specified by data
-   @param format the format of the pixel data in data
-   @param data one-dimensional array of pixel and type of array
-*)
-external glColorTable: glenum -> glenum -> int -> glenum ->
-  [< `BAByte of (char, Bigarray.int8_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAShort of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUShort of (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit = "gl_api_glColorTable"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml}
+    manual pages on opengl.org}
+*)
+external glFrustum : left:float -> right:float -> bottom:float ->
+  top:float -> near:float -> far:float -> unit
+    = "gl_auto_glFrustum_bytecode" "gl_auto_glFrustum"

-(**
-   Respecify a portion of a color table
-
-   @param target type of color lookup table
-   @param start the staring index of the portion of the color table to be replaced.
-   @param count the number of table entries to replace
-   @param format the format of the pixel data in data
-   @param data one-dimensional array of pixel data and type.
-*)
-external glColorSubTable: glenum -> int -> int -> glenum ->
-  [< `BAByte of (char, Bigarray.int8_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUByte of (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAShort of (int, Bigarray.int16_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUShort of (int, Bigarray.int16_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAUInt of (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  | `BAFloat of (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
-  ] -> unit = "gl_api_glColorSubTable"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glViewport.xml}
+    manual pages on opengl.org}
+*)
+external glViewport : x:int -> y:int -> width:int -> height:int -> unit
+  = "gl_auto_glViewport"

-(**
-   Retrieve contents of a color lookup table
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPushMatrix.xml}
+    manual pages on opengl.org}
+*)
+external glPushMatrix : unit -> unit = "gl_auto_glPushMatrix"
+external glPopMatrix : unit -> unit = "gl_auto_glPopMatrix"

-   @param target type of color lookup table
-   @param format format of the pixel data in table
-   @param type type of the pixel data
-   @param one-dimensional array of pixel data and data type. Given
-   bigarray have to need to allocate enough size for size of pixel data.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLoadIdentity.xml}
+    manual pages on opengl.org}
 *)
-external glGetColorTable: glenum -> glenum -> glenum -> big_array_type
-  -> unit = "gl_api_glGetColorTable"
+external glLoadIdentity : unit -> unit = "gl_auto_glLoadIdentity"

-(**
-   Get color lookup table parameters
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLoadMatrix.xml}
+    manual pages on opengl.org}
+*)
+external glLoadMatrixf : float array -> unit = "gl_auto_glLoadMatrixf"

-   @param target target color table
-   @param pname color lookup table parameter
-   @return requested data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMultMatrix.xml}
+    manual pages on opengl.org}
 *)
-external glGetColorTableParameterfv: glenum -> glenum -> float array = "gl_api_glGetColorTableParameterfv"
-external glGetColorTableParameteriv: glenum -> glenum -> int array = "gl_api_glGetColorTableParameteriv"
+external glMultMatrix : float array -> unit = "gl_auto_glMultMatrix"

-(**
-   Get histogram table
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml}
+    manual pages on opengl.org}
+*)
+external glRotate : angle:float -> x:float -> y:float -> z:float -> unit
+  = "gl_auto_glRotate"

-   @param target Must be GL_HISTOGRAM
-   @param reset if true, each component counter that is actually returned is reset to zero
-   @param format format of values to be returned
-   @param data storing histgram data by this function before
-   already-allocated bigarray and data type.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glScale.xml}
+    manual pages on opengl.org}
 *)
-external glGetHistogram: glenum -> bool -> glenum ->
-  big_array_type -> unit = "gl_api_glGetHistogram"
+external glScale : x:float -> y:float -> z:float -> unit = "gl_auto_glScale"

-(**
-   Get histogram table parameters
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTranslate.xml}
+    manual pages on opengl.org}
+*)
+external glTranslate : x:float -> y:float -> z:float -> unit = "gl_auto_glTranslate"

-   @param target Must be one of GL_HISTOGRAM or GL_PROXY_HISTOGRAM
-   @param pname name of the parameter to be retrieved
-   @return requested values
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glIsList.xml}
+    manual pages on opengl.org}
 *)
-external glGetHistogramParameterfv: glenum -> glenum -> float = "gl_api_glGetHistogramParameterfv"
-external glGetHistogramParameteriv: glenum -> glenum -> int = "gl_api_glGetHistogramParameteriv"
+external glIsList : int -> bool = "gl_auto_glIsList"

-(**
-   Get minimum and maximum pixel values
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDeleteLists.xml}
+    manual pages on opengl.org}
+*)
+external glDeleteLists : list:int -> range:int -> unit = "gl_auto_glDeleteLists"

-   @param target Must be GL_MINMAX
-   @param reset all entries in the minmax table that are actually returned are zero if true
-   @param format format of the data to be returned value
-   @param data Storaging value by this function have to be already allocated.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGenLists.xml}
+    manual pages on opengl.org}
 *)
-external glGetMinmax: glenum -> bool -> glenum -> big_array_type -> unit = "gl_api_glGetMinmax"
+external glGenLists : int -> int = "gl_auto_glGenLists"

-(**
-   Get minmax parameters
+module NewList = Enums.NewList
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glNewList.xml}
+    manual pages on opengl.org}
+*)
+external glNewList : list:int -> mode:NewList.newlist_mode -> unit
+  = "gl_auto_glNewList"
+external glEndList : unit -> unit = "gl_auto_glEndList"

-   @param target must be GL_MINMAX
-   @param pname parameter to be retrieved
-   @return retrieved parameter data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCallList.xml}
+    manual pages on opengl.org}
 *)
-external glGetMinmaxParameterfv: glenum -> glenum -> float = "gl_api_glGetMinmaxParameterfv"
-external glGetMinmaxParameteriv: glenum -> glenum -> int = "gl_api_glGetMinmaxParameteriv"
+external glCallList : int -> unit = "gl_auto_glCallList"

-(**
-   Define a one-dimensional convolution filter
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glListBase.xml}
+    manual pages on opengl.org}
+*)
+external glListBase : int -> unit = "gl_auto_glListBase"

-   @param target Must be GL_CONVOLUTION_1D
-   @param internalformat internal format of the convolution filter kernel.
-   @param width width of th epixel array referenced by data
-   @param format format of the pixel
-   @param data type of pixel data and one-dimensional array of pixel data
+module Begin = Enums.Begin
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glBegin.xml}
+    manual pages on opengl.org}
 *)
-external glConvolutionFilter1D: glenum -> glenum -> int -> glenum ->
-  big_array_type -> unit = "gl_api_glConvolutionFilter1D"
+external glBegin : Begin.draw_mode -> unit = "gl_auto_glBegin"
+external glEnd : unit -> unit = "gl_auto_glEnd"

-(**
-   Define a two-dimensional convolution filter
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glVertex.xml}
+    manual pages on opengl.org}
+*)
+external glVertex2 : x:float -> y:float -> unit = "gl_auto_glVertex2"
+external glVertex3 : x:float -> y:float -> z:float -> unit = "gl_auto_glVertex3"
+external glVertex4 : x:float -> y:float -> z:float -> w:float -> unit = "gl_auto_glVertex4"

-   @param target Must be GL_CONVOLUTION_1D
-   @param internalformat internal format of the convolution filter kernel.
-   @param width width of th epixel array referenced by data
-   @param height width of th epixel array referenced by data
-   @param format format of the pixel
-   @param data type of pixel data and one-dimensional array of pixel data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glNormal.xml}
+    manual pages on opengl.org}
 *)
-external glConvolutionFilter2D: glenum -> glenum -> int -> int -> glenum ->
-  big_array_type -> unit = "gl_api_glConvolutionFilter2D_native"
-    "gl_api_glConvolutionFilter2D_bytecode"
+external glNormal : x:float -> y:float -> z:float -> unit = "gl_auto_glNormal"

-(**
-   Get current 1D or 2D convolution filter kernel
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glIndex.xml}
+    manual pages on opengl.org}
+*)
+external glIndexf : float -> unit = "gl_auto_glIndex"

-   @param target Must be GL_CONVOLUTION_1D or GL_CONVOLUTION_2D
-   @param format format of the pixel
-   @param data pointer to storage for the output image that is
-   already-allocated bigarray.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glColor.xml}
+    manual pages on opengl.org}
 *)
-external glGetConvolutionFilter: glenum -> glenum ->
-  big_array_type -> unit = "gl_api_glGetConvolutionFilter"
+external glColor3 : red:float -> green:float -> blue:float -> unit = "gl_auto_glColor3"
+external glColor4 : red:float -> green:float -> blue:float -> alpha:float -> unit
+  = "gl_auto_glColor4"

-(**
-   Get current convolution parameters
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexCoord.xml}
+    manual pages on opengl.org}
+*)
+external glTexCoord1 : float -> unit = "gl_auto_glTexCoord1"
+external glTexCoord2 : s:float -> t:float -> unit = "gl_auto_glTexCoord2"
+external glTexCoord3 : s:float -> t:float -> r:float -> unit
+  = "gl_auto_glTexCoord3"
+external glTexCoord4 : s:float -> t:float -> r:float -> q:float -> unit
+  = "gl_auto_glTexCoord4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glRasterPos.xml}
+    manual pages on opengl.org}
+*)
+external glRasterPos2 : x:float -> y:float -> unit = "gl_auto_glRasterPos2"
+external glRasterPos3 : x:float -> y:float -> z:float -> unit = "gl_auto_glRasterPos3"
+external glRasterPos4 : x:float -> y:float -> z:float -> w:float -> unit
+  = "gl_auto_glRasterPos4"

-   @param target filter whose parameters are to be retrieved
-   @param pname the parameter to be retrieved
-   @return pointer to storage for the parameters to be retrieved
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glRect.xml}
+    manual pages on opengl.org}
 *)
-external glGetConvolutionParameterfv: glenum -> glenum -> float array = "gl_api_glGetConvolutionParameterfv"
-external glGetConvolutionParameteriv: glenum -> glenum -> int array = "gl_api_glGetConvolutionParameteriv"
+external glRectf : x1:float -> y1:float -> x2:float -> y2:float -> unit = "gl_auto_glRect"

-(**
-   Specify a one-dimensional texture image in a compressed format
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glArrayElement.xml}
+    manual pages on opengl.org}
+*)
+external glArrayElement : int -> unit = "gl_auto_glArrayElement"

-   @param target Specifies the target texture
-   @param level level-of-detail
-   @param internal format format of the compressed image data
-   @param width width of the texture image
-   @param border width of the border. Must be either 1 or 0.
-   @param imageSize number of unsigned bytes of image data
-   @param data compressed image data
+module DrawArrays = Enums.DrawArrays
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDrawArrays.xml}
+    manual pages on opengl.org}
 *)
-external glCompressedTexImage1D: glenum -> int -> glenum -> int ->
-  int -> int -> big_array_type -> unit =
-    "gl_api_glCompressedTexImage1D_native"
-      "gl_api_glCompressedTexImage1D_bytecode"
+external glDrawArrays : mode:DrawArrays.draw_mode -> first:int -> count:int -> unit
+  = "gl_auto_glDrawArrays"

-(**
-   Specify a two-dimensional texture image in a compressed format
-
-   @param target Specifies the target texture
-   @param level level-of-detail
-   @param internal format format of the compressed image data
-   @param width width of the texture image
-   @param height height of the texture image
-   @param border width of the border. Must be either 1 or 0.
-   @param imageSize number of unsigned bytes of image data
-   @param data compressed image data
-*)
-external glCompressedTexImage2D: glenum -> int -> glenum -> int ->
-  int -> int -> int -> big_array_type -> unit =
-    "gl_api_glCompressedTexImage2D_native"
-      "gl_api_glCompressedTexImage2D_bytecode"
+module Shade = Enums.Shade
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glShadeModel.xml}
+    manual pages on opengl.org}
+*)
+external glShadeModel : Shade.shade_mode -> unit = "gl_auto_glShadeModel"

-(**
-   Specify a one-dimensional texture image in a compressed format
-
-   @param target Specifies the target texture
-   @param level level-of-detail
-   @param internal format format of the compressed image data
-   @param width width of the texture image
-   @param height height of the texture image
-   @param depth depth of the texture image
-   @param border width of the border. Must be either 1 or 0.
-   @param imageSize number of unsigned bytes of image data
-   @param data compressed image data
-*)
-external glCompressedTexImage3D: glenum -> int -> glenum -> int ->
-  int -> int -> int -> int -> big_array_type -> unit =
-    "gl_api_glCompressedTexImage3D_native"
-      "gl_api_glCompressedTexImage3D_bytecode"
+(** type of number of light  *)
+type gl_light = GL_LIGHT of int

-(**
-   Specify a one-dimensional texture subimage in a compressed format
+module Light = Enums.Light

-   @param target Specifies the target texture
-   @param level level-of-detail
-   @param xoffset a texel offset in the x direction with in th etexture array
-   @param width width of the texture image
-   @param format format of the compressed image data
-   @param imageSize number of unsigned bytes of image data
-   @param data compressed image data
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLight.xml}
+    manual pages on opengl.org}
 *)
-external glCompressedTexSubImage1D: glenum -> int -> int -> int ->
-  glenum -> int -> big_array_type -> unit =
-    "gl_api_glCompressedTexSubImage1D_native"
-      "gl_api_glCompressedTexSubImage1D_bytecode"
+external glLight1 : light_i:gl_light -> pname:Light.set_light_1 ->
+  value:float -> unit = "gl_auto_glLight1"
+external glLight3 : light_i:gl_light ->
+  value:float * float * float -> unit = "gl_auto_glLight3"
+external glLight4 : light_i:gl_light -> pname:Light.set_light_4 ->
+  value:float * float * float * float -> unit = "gl_auto_glLight4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLightModel.xml}
+    manual pages on opengl.org}
+*)
+external glLightModel : pname:Light.light_model -> value:float array -> unit = "gl_auto_glLightModel"
+external glLightModelControl :Light.light_model_control -> unit = "gl_auto_glLightModel4"

-(**
-   Specify a two-dimensional texture subimage in a compressed format
-
-   @param target Specifies the target texture
-   @param level level-of-detail
-   @param xoffset a texel offset in the x direction with in th etexture array
-   @param yoffset a texel offset in the y direction with in th etexture array=
-   @param width width of the texture image
-   @param height height of the texture image
-   @param format format of the compressed image data
-   @param imageSize number of unsigned bytes of image data
-   @param data compressed image data
-*)
-external glCompressedTexSubImage2D: glenum -> int -> int -> int -> int ->
-  int -> glenum -> int -> big_array_type -> unit =
-    "gl_api_glCompressedTexSubImage2D_native"
-      "gl_api_glCompressedTexSubImage2D_bytecode"
+module Material = Enums.Material
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMaterial.xml}
+    manual pages on opengl.org}
+*)
+external glMaterial : face:Material.face_mode -> pname:Material.set_material -> value:float array -> unit
+  = "gl_auto_glMaterial"

-(**
-   Specify a three-dimensional texture subimage in a compressed format
-
-   @param target Specifies the target texture
-   @param level level-of-detail
-   @param xoffset a texel offset in the x direction with in th etexture array
-   @param yoffset a texel offset in the y direction with in th etexture array=
-   @param zoffset a texel offset in the z direction with in th etexture array=
-   @param width width of the texture image
-   @param height height of the texture image
-   @param depth depth of the texture image
-   @param format format of the compressed image data
-   @param imageSize number of unsigned bytes of image data
-   @param data compressed image data
-*)
-external glCompressedTexSubImage3D: glenum -> int -> int -> int -> int -> int ->
-  int -> int -> glenum -> int -> big_array_type -> unit =
-  "gl_api_glCompressedTexSubImage3D_native"
-    "gl_api_glCompressedTexSubImage3D_bytecode"
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glColorMaterial.xml}
+    manual pages on opengl.org}
+*)
+external glColorMaterial : face:Material.face_mode -> mode:Material.material_4f -> unit
+  = "gl_auto_glColorMaterial"

-(**
-   return a compressed texture image
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPixelZoom.xml}
+    manual pages on opengl.org}
+*)
+external glPixelZoom : xfactor:float -> yfactor:float -> unit = "gl_auto_glPixelZoom"
+
+(* Alignment for requirements for the start of each pixel row in memroy  *)
+type pixel_alignment =
+| GL_ALIGN_1
+| GL_ALIGN_2
+| GL_ALIGN_4
+| GL_ALIGN_8
+
+module Pixels = Enums.Pixels
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPixelStore.xml}
+    manual pages on opengl.org}
+*)
+external glPixelStoreb : pname:Pixels.pixel_store_boolean -> param:bool -> unit
+  = "gl_auto_glPixelStoreb"
+external glPixelStorei : pname:Pixels.pixel_store_integer -> param:int -> unit
+  = "gl_auto_glPixelStorei"
+external glPixelStore_align : pname:Pixels.pixel_store_align -> param:pixel_alignment -> unit
+  = "gl_auto_glPixelStore_align"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPixelTransfer.xml}
+    manual pages on opengl.org}
+*)
+external glPixelTransferb : pname:Pixels.pixel_transfer_boolean -> param:boolean -> unit
+  = "gl_auto_glPixelTransferb"
+external glPixelTransferf : pname:Pixels.pixel_transfer_float -> param:float -> unit
+  = "gl_auto_glPixelTransferf"
+external glPixelTransferi : pname:Pixels.pixel_transfer_integer -> param:float -> unit
+  = "gl_auto_glPixelTransferi"
+
+type pixel_map = (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPixelMap.xml}
+    manual pages on opengl.org}
+*)
+external glPixelMap : map:Pixels.pixel_map -> values:pixel_map -> unit
+  = "gl_auto_glPixelMap"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetPixelMap.xml}
+    manual pages on opengl.org}
+*)
+external glGetPixelMap : Pixels.pixel_map -> pixel_map = "gl_auto_glGetPixelMap"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glBigmap.xml}
+    manual pages on opengl.org}
+*)
+external glBitmap : width:int -> height:int -> xorig:float -> yorig:float ->
+  xmove:float -> ymove:float ->
+    bitmap:image_type -> unit
+      = "gl_auto_glBitmap_bytecode" "gl_auto_glBitmap"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyPixels.xml}
+    manual pages on opengl.org}
+*)
+external glCopyPixels : x:int -> y:int -> width:int -> height:int ->
+  copy_type:Pixels.pixel_copy_type -> unit
+    = "gl_auto_glCopyPixels"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glStencilFunc.xml}
+    manual pages on opengl.org}
+*)
+external glStencilFunc : func:Func.compare_func -> func_ref:int -> mask:int -> unit
+  = "gl_auto_glStencilFunc"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glStencilMask.xml}
+    manual pages on opengl.org}
+*)
+external glStencilMask : int -> unit = "gl_auto_glStencilMask"
+
+module Stencil = Enums.Stencil
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glStencilOp.xml}
+    manual pages on opengl.org}
+*)
+external glStencilOp : fail:Stencil.stencil_op -> zfail:Stencil.stencil_op
+  -> zpass:Stencil.stencil_op -> unit = "gl_auto_glStencilOp"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glClearStencil.xml}
+    manual pages on opengl.org}
+*)
+external glClearStencil : int -> unit = "gl_auto_glClearStencil"
+
+module Tex = Enums.Tex
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexGen.xml}
+    manual pages on opengl.org}
+*)
+external glTexGen1 : coord:Tex.coord -> pname:Tex.texgen_func -> unit
+  = "gl_auto_glTexGen1"
+external glTexGen4 : coord:Tex.coord -> pname:Tex.texgen_plane ->
+  param:float * float * float * float -> unit = "gl_auto_glTexGen4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml}
+    manual pages on opengl.org}
+*)
+external glTexEnv1 : Tex.texgen_env_func ->  unit = "gl_auto_glTexEnv1"
+external glTexEnv4 : float * float * float * float -> unit = "gl_auto_glTexEnv4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml}
+    manual pages on opengl.org}
+*)
+external glTexParameter1 : target:Tex.texture_image_type ->
+  pname:Tex.tex_parameter_1 -> value:float -> unit
+    = "gl_auto_glTexParameter1"
+(* for GL_TEXTURE_BORDER_COLOR *)
+external glTexParameter4 : target:Tex.texture_image_type ->
+  value:float * float * float * float -> unit = "gl_auto_glTexParameter4"
+
+(* for filter *)
+external glTexParameter_filter : target:Tex.texture_image_type ->
+  pname:Tex.tex_parameter_filter ->
+    filter:Tex.tex_parameter_filter_type ->
+      unit = "gl_auto_glTexParameter_filter"
+
+(* for type of wrap *)
+external glTexParameter_wrap : target:Tex.texture_image_type ->
+  pname:Tex.tex_parameter_wrap ->
+    filter:Tex.tex_parameter_wrap_type ->
+      unit = "gl_auto_glTexParameter_filter"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetTexParameter.xml}
+    manual pages on opengl.org}
+*)
+external glGetTexParameter1 : target:Tex.texture_image_type -> pname:TEx.tex_parameter_1 -> float
+  = "gl_auto_glGetTexParameter1"
+external glGetTexParameter4 : Tex.texture_image_type -> float * float * float * float
+  = "gl_auto_glGetTexParameter4"
+
+external glGetTexParameter_filter : target:Tex.texture_image_type ->
+  pname:Tex.tex_parameter_filter -> Tex.tex_parameter_filter_type
+    = "gl_auto_glGetTexParameter_filter"
+
+(* for type of wrap *)
+external glGetTexParameter_wrap : target:Tex.texture_image_type ->
+  pname:Tex.tex_parameter_wrap -> Tex.tex_parameter_wrap_type
+    = "gl_auto_glGetTexParameter_filter"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGenTextures.xml}
+    manual pages on opengl.org}
+*)
+external glGenTextures : int -> (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
+  = "gl_auto_glGenTextures"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDeleteTextures.xml}
+    manual pages on opengl.org}
+*)
+external glDeleteTextures : int -> (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+  = "gl_auto_glDeleteTextures"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glBindTexture.xml}
+    manual pages on opengl.org}
+*)
+external glBindTexture : target:Tex.texture_image_type -> texture:int -> unit
+  = "gl_auto_glBindTexture"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPrioritizeTextures.xml}
+    manual pages on opengl.org}
+*)
+external glPrioritizeTextures : textures:(int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
+  -> priorities:(float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+    = "gl_auto_glPrioritizeTextures"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glAreTexturesResident.xml}
+    manual pages on opengl.org}
+*)
+external glAreTexturesResident : textures:int array -> residences:bool array -> bool
+  = "gl_auto_glAreTexturesResident"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glIsTexture.xml}
+    manual pages on opengl.org}
+*)
+external glIsTexture : texture:int -> bool = "gl_auto_glIsTexture"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage1D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyTexImage1D : level:int -> format:Tex.internal_format ->
+  x:int -> y:int -> width:int -> border:int -> unit
+    = "gl_auto_glCopyTexImage1D_bytecode" "gl_auto_glCopyTexImage1D"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyTexImage2D : level:int -> format:Tex.internal_format ->
+  x:int -> y:int -> width:int -> height:int -> border:int -> unit
+    = "gl_auto_glCopyTexImage2D_bytecode" "gl_auto_glCopyTexImage2D"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexSubImage1D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyTexSubImage1D : level:int -> xoffset:int -> x:int -> y:int -> width:int -> unit
+  = "gl_auto_glCopyTexSubImage1D_bytecode" "gl_auto_glCopyTexSubImage1D"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexSubImage2D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyTexSubImage2D : level:int -> xoffset:int -> yoffset:int -> x:int -> y:int ->
+  width:int -> height:int -> unit
+    = "gl_auto_glCopyTexSubImage2D_bytecode" "gl_auto_glCopyTexSubImage2D"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexSubImage3D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyTexSubImage3D : level:int -> xoffset:int -> yoffset:int -> zoffset:int ->
+  x:int -> y:int -> width:int -> height:int -> unit
+    = "gl_auto_glCopyTexSubImage3D_bytecode" "gl_auto_glCopyTexSubImage3D"
+
+module Eval = Enums.Eval
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMap.xml}
+    manual pages on opengl.org}
+*)
+external glMap1_1 : target:Eval.map_target_1_1 -> u1:float -> u2:float -> stride:int ->
+  order:int -> value:float -> unit = "gl_auto_glMap1_1_bytecode" "gl_auto_glMap1_1"
+external glMap1_2 : u1:float -> u2:float -> stride:int ->
+  order:int -> value:float * float -> unit
+    = "gl_auto_glMap1_2_bytecode" "gl_auto_glMap1_2"
+external glMap1_3 : target:Eval.map_target_1_3 -> u1:float -> u2:float -> stride:int ->
+  order:int -> value:float * float * float -> unit
+    = "gl_auto_glMap1_3_bytecode" "gl_auto_glMap1_3"
+external glMap1_4 : target:Eval.map_target_1_4 -> u1:float -> u2:float -> stride:int ->
+  order:int -> value:float * float * float * float -> unit
+    = "gl_auto_glMap1_4_bytecode" "gl_auto_glMap1_4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMap2.xml}
+    manual pages on opengl.org}
+*)
+external glMap2_1 : target:Eval.map_target_2_1 -> u1:float -> u2:float -> ustride:int ->
+  uorder:int -> v1:float -> v2:float -> vstride:int -> vorder:int ->
+    value:float -> unit = "gl_auto_glMap2_1_bytecode" "gl_auto_glMap2_1"
+external glMap2_2 : u1:float -> u2:float -> ustride:int ->
+  uorder:int -> v1:float -> v2:float -> vstride:int -> vorder:int ->
+    value:float * float -> unit = "gl_auto_glMap2_2_bytecode" "gl_auto_glMap2_2"
+external glMap2_3 : target:Eval.map_target_2_3 -> u1:float -> u2:float -> ustride:int ->
+  uorder:int -> v1:float -> v2:float -> vstride:int -> vorder:int ->
+    value:float * float * float -> unit = "gl_auto_glMap2_3_bytecode" "gl_auto_glMap2_3"
+external glMap2_4 : target:Eval.map_target_2_4 -> u1:float -> u2:float -> ustride:int ->
+  uorder:int -> v1:float -> v2:float -> vstride:int -> vorder:int ->
+    value:float * float * float * float -> unit
+      = "gl_auto_glMap2_4_bytecode" "gl_auto_glMap2_4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEvalCoord.xml}
+    manual pages on opengl.org}
+*)
+external glEvalCoord1: float -> unit = "gl_auto_glEvalCoord1"
+external glEvalCoord2 : u:float -> v:float -> unit = "gl_auto_glEvalCoord2"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMapGrid.xml}
+    manual pages on opengl.org}
+*)
+external glMapGrid1 : un:int -> u1:float -> u2:float -> unit
+  = "gl_auto_glMapGrid1"
+external glMapGrid2 : un:int -> u1:float -> u2:float -> vn:int -> v1:float -> v2:float -> unit
+  = "gl_auto_glMapGrid2_bytecode" "gl_auto_glMapGrid2"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEvalPoint.xml}
+    manual pages on opengl.org}
+*)
+external glEvalPoint1 : int -> unit = "gl_auto_glEvalPoint1"
+external glEvalPoint2 : i:int -> j:int -> unit = "gl_auto_glEvalPoint2"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEvalMesh.xml}
+    manual pages on opengl.org}
+*)
+external glEvalMesh1 : mode:Eval.mesh_mode_1 -> i1:int -> i2:int -> unit
+  = "gl_auto_glEvalMesh1"
+external glEvalMesh2 : mode:Eval.mesh_mode_2 -> i1:int -> i2:int -> j1:int -> j2:int -> unit
+  = "gl_auto_glEvalMesh2"
+
+module Fog = Enums.Fog
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glFog.xml}
+    manual pages on opengl.org}
+*)
+external glFog_mode : mode:Fog.fog_mode -> param:Fog.fog_mode_param -> unit
+  = "gl_auto_glFog_mode"
+external glFog1 : pname:Fog.fog_value_type -> param:float -> unit
+  = "gl_auto_glFog1"
+external glFog4 : float * float * float * float -> unit
+  = "gl_auto_glFog4"
+
+(*TODO
+  glFeedbackBuffer
+  glPassThrough
+*)
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glSelectBuffer.xml}
+    manual pages on opengl.org}
+*)
+external glSelectBuffer : int -> (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
+  = "gl_auto_glSelectBuffer"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glInitNames.xml}
+    manual pages on opengl.org}
+*)
+external glInitNames : unit -> unit = "gl_auto_glInitNames"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLoadName.xml}
+    manual pages on opengl.org}
+*)
+external glLoadName : int -> unit = "gl_auto_glLoadName"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glPushName.xml}
+    manual pages on opengl.org}
+*)
+external glPushName : int -> unit = "gl_auto_glPushName"
+external glPopName : unit -> unit = "gl_auto_glPopName"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glBlendEquation.xml}
+    manual pages on opengl.org}
+*)
+external glBlendEquation : Func.blend_func -> unit = "gl_auto_glBlendEquation"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glBlendColor.xml}
+    manual pages on opengl.org}
+*)
+external glBlendColor : red:float -> green:float -> blue:float -> alpha:float -> unit
+  = "gl_auto_glBlendColor"
+
+module Histogram = Enums.Histogram
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glHistogram.xml}
+    manual pages on opengl.org}
+*)
+external glHistogram : target:Histogram.histogram -> width:int ->
+  internalformat:Histogram.internal_format -> sink:bool -> unit
+    = "gl_auto_glHistogram"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glResetHistogram.xml}
+    manual pages on opengl.org}
+*)
+external glResetHistogram : unit -> unit = "gl_auto_glResetHistogram"
+
+module Convolution = Enums.Convolution
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glConvolutionParameter.xml}
+    manual pages on opengl.org}
+*)
+external glConvolutionParameter_border : target:Convolution.convolution_target ->
+  mode:Convolution.convolution_border_mode -> unit
+  = "gl_auto_glConvolutionParameter_border"
+external glConvolutionParameter : target:Convolution.convolution_target ->
+  pname:Convolution.convolution_pname -> param:float * float * float * float -> unit
+    = "gl_auto_glConvolutionParameter"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyConvolutionFilter1D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyConvolutionFilter1D : internalformat:Convolution.internal_format ->
+  x:int -> y:int -> width:int -> unit
+    = "gl_auto_glCopyConvolutionFilter1D"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCopyConvolutionFilter2D.xml}
+    manual pages on opengl.org}
+*)
+external glCopyConvolutionFilter2D : internalformat:Convolution.internal_format ->
+  x:int -> y:int -> width:int -> height:int -> unit
+    = "gl_auto_glCopyConvolutionFilter2D"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml}
+    manual pages on opengl.org}
+*)
+external glActiveTexture : int -> unit = "gl_auto_glActiveTexture"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMultiTexCoord.xml}
+    manual pages on opengl.org}
+*)
+external glMultiTexCoord1 : texture:int -> s:float -> unit = "gl_auto_glMultiTexCoord1"
+external glMultiTexCoord2 : texture:int -> s:float -> t:float -> unit
+  = "gl_auto_glMultiTexCoord2"
+external glMultiTexCoord3 : texture:int -> s:float -> t:float -> r:float -> unit
+  = "gl_auto_glMultiTexCoord3"
+external glMultiTexCoord4 : texture:int -> s:float -> t:float -> r:float -> q:float -> unit
+  = "gl_auto_glMultiTexCoord4d"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glLoadTransposeMatrix.xml}
+    manual pages on opengl.org}
+*)
+external glLoadTransposeMatrix : (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+  = "gl_auto_glLoadTransposeMatrix"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glMultTransposeMatrix.xml}
+    manual pages on opengl.org}
+*)
+external glMultTransposeMatrix : (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
+  = "gl_auto_glMultTransposeMatrix"

-   @param target specifies which texture is to be obtained
-   @param lod level-of-detail
-   @param data Retrieving compressed texture image is alreadly
-   allocated bigarray.
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glSampleCoverage.xml}
+    manual pages on opengl.org}
+*)
+external glSampleCoverage : value:float -> invert:bool -> unit
+  = "gl_auto_glSampleCoverage"
+
+module CallList = Enums.CallList
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glCallLists.xml}
+    manual pages on opengl.org}
+*)
+external glCallLists : size:int ->
+  list_type:CallList.call_list_type
+  -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t
+    -> unit = "gl_api_glCallLists"
+
+module Vertex = Enums.Vertex
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glVertexPointer.xml}
+    manual pages on opengl.org}
+*)
+external glVertexPointer2 : pointer_type:Vertex.vertex_pointer_type ->
+  stride:int -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit = "gl_api_glVertexPointer2"
+external glVertexPointer3 : pointer_type:Vertex.vertex_pointer_type ->
+  stride:int -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit = "gl_api_glVertexPointer3"
+external glVertexPointer4 : pointer_type:Vertex.vertex_pointer_type ->
+  stride:int -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit = "gl_api_glVertexPointer4"
+
+module Normal = Enums.Normal
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glNormalPointer.xml}
+    manual pages on opengl.org}
+*)
+external glNormalPointer : pointer_type:Normal.normal_pointer_type ->
+  stride:int -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+    = "gl_api_glNormalPointer"
+
+module Color = Enums.Color
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glColorPointer.xml}
+    manual pages on opengl.org}
+*)
+external glColorPointer : pointer_type:Color.color_pointer_type ->
+  stride:int -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+    = "gl_api_glColorPointer3"
+
+module Index = Enums.Index
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glIndexPointer.xml}
+    manual pages on opengl.org}
+*)
+external glIndexPointer : pointer_type:Index.index_pointer_type ->
+  stride:int ->
+    list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit = "gl_api_glIndexPointer"
+
+module TexCoord = Enums.TexCoord
+
+external glTexCoordPointer1 : pointer_type:TexCoord.texcoord_pointer_type
+  -> stride:int
+    -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+      = "gl_api_glTexCoordPointer1"
+external glTexCoordPointer2 : pointer_type:TexCoord.texcoord_pointer_type
+  -> stride:int
+    -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+      = "gl_api_glTexCoordPointer2"
+external glTexCoordPointer3 : pointer_type:TexCoord.texcoord_pointer_type
+  -> stride:int
+    -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+      = "gl_api_glTexCoordPointer3"
+external glTexCoordPointer4 : pointer_type:TexCoord.texcoord_pointer_type
+  -> stride:int
+    -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+      = "gl_api_glTexCoordPointer4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEdgeFlagPointer.xml}
+    manual pages on opengl.org}
+*)
+external glEdgeFlagPointer : stride:int -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t
+  -> unit = "gl_api_glEdgeFlagPointer"
+
+module DrawElements = Enums.DrawElements
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDrawElements.xml}
+    manual pages on opengl.org}
+*)
+external glDrawElements : mode:DrawElements.draw_mode ->
+  elements_type:draw_elements_type -> list:('a, 'b, Bigarray.c_layout) Bigarray.Array1.t -> unit
+    = "gl_api_glDrawElements"
+
+type tuple_type =
+| Tuple1 of float
+| Tuple3 of float * float * float
+| Tuple4 of float * float * float * float
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetLight.xml}
+    manual pages on opengl.org}
+*)
+external _glGetLightf1 : ~light_i:int -> int -> float = "gl_api_glGetLightf1"
+external _glGetLightf3 : ~light_i:int -> float * float * float = "gl_api_glGetLightf3"
+external _glGetLightf4 : ~light_i:int -> int -> float * float * float * float = "gl_api_glGetLightf4"
+
+let glGetLight ~light ~pname =
+  let light_i = match light with GL_LIGHT i -> i in
+  match pname with
+  (* four value of tuple *)
+  | Light.GL_AMBIENT -> Tuple4 (_glGetLightf4 ~light_i 0)
+  | Light.GL_DIFFUSE -> Tuple4 (_glGetLightf4 ~light_i 1)
+  | Light.GL_SPECULAR -> Tuple4 (_glGetLightf4 ~light_i 2)
+  | Light.GL_POSITION -> Tuple4 (_glGetLightf4 ~light_i 3)
+  (* three value of tuple *)
+  | Light.GL_SPOT_DIRECTION -> Tuple3 (_glGetLightf3 ~light_i)
+  (* a value  *)
+  | Light.GL_SPOT_EXPONENT -> Tuple1 (_glGetLightf1 ~light_i 5)
+  | Light.GL_SPOT_CUTOFF -> Tuple1 (_glGetLightf1 ~light_i 6)
+  | Light.GL_CONSTANT_ATTENUATION_ -> Tuple1 (_glGetLightf1 ~light_i 7)
+  | Light.GL_LINEAR_ATTENUATION -> Tuple1 (_glGetLightf1 ~light_i 8)
+  | Light.GL_QUADRATIC_ATTENUATION -> Tuple1 (_glGetLightf1 9)
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetMaterial.xml}
+    manual pages on opengl.org}
+*)
+external glGetMaterialf1 : Mateiral.face_mode ->
+  Material.material_1f -> float = "gl_api_glGetMaterialf1"
+external glGetMaterialf3 : Material.face_mode ->
+  Material.material_3f -> float * float * float = "gl_api_glGetMaterialf3"
+external glGetMaterialf4 : Material.face_mode ->
+  Material.material_4f -> float * float * float * float  = "gl_api_glGetMaterialf4"
+
+type image_type = (int, Bigarray.int8_signed_elt, Bigarray.c_layout) Bigarray.Array1.t
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glReadPixels.xml}
+    manual pages on opengl.org}
+*)
+external glReadPixels : x:int -> y:int -> width:int -> height:int ->
+  format:Pixels.read_pixel_format -> pixel_type:Pixels.read_pixel_type -> image:image_type ->
+    unit = "gl_api_glReadPixels_native"
+  "gl_api_glReadPixels_bytecode"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDrawPixels.xml}
+    manual pages on opengl.org}
+*)
+external glDrawPixels : width:int -> height:int ->
+  format:Pixels.read_pixel_format -> pixel_type:Pixels.read_pixel_type ->
+    image:image_type -> unit = "gl_api_glDrawPixels"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetTexGen.xml}
+    manual pages on opengl.org}
+*)
+external glGetTexGen1 : coord:Tex.coord -> func:Tex.texgen_func = "gl_api_glGetTexGenf1"
+external glGetTexGen4 : coord:Tex.coord -> pname:Tex.texgen_plane ->
+  float * float * float * float = "gl_api_glGetTexGen4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetTexEnv.xml}
+    manual pages on opengl.org}
+*)
+external glGetTexEnv1 : unit -> Tex.texgen_env_func = "gl_api_glGetTexEnv1"
+external glGetTexEnv4 : unit -> float * float * float * float = "gl_api_glGetTexEnv4"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetTexLevelParameter.xml}
+    manual pages on opengl.org}
+*)
+external glGetTexLevelParameter_format: target:Tex.texlevel_target ->
+  level:int -> Tex.internal_format = "gl_api_glGetTexLevelParameter_format"
+external glGetTexLevelParameter: target:Tex.texlevel_target ->
+  level:int -> pname:Tex.texlevel_pname -> int = "gl_api_glGetTexLevelParameter"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexImage1D.xml}
+    manual pages on opengl.org}
+*)
+external glTexImage1D: image_type:Tex.image_1d_type -> level:int ->
+  internal_format:Tex.internal_format -> width:int -> border:bool ->
+    format:Tex.texture_format -> texture_type:Tex.texture_type -> image_data -> unit
+      = "gl_api_glTexImage1D_native"
+  "gl_api_glTexImage1D_bytecode"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml}
+    manual pages on opengl.org}
+*)
+external glTexImage2D: image_type:Tex.image_2d_type -> level:int ->
+  internal_format:Tex.internal_format -> height:int -> width:int -> border:bool ->
+    format:Tex.texture_format -> texture_type:Tex.texture_type -> image_data -> unit
+      = "gl_api_glTexImage2D_native"
+  "gl_api_glTexImage2D_bytecode"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexImage3D.xml}
+    manual pages on opengl.org}
+*)
+external glTexImage3D: image_type:Tex.image_3d_type -> level:int ->
+  internal_format:Tex.internal_format -> height:int -> width:int -> depth:int -> border:bool ->
+    format:Tex.texture_format -> texture_type:Tex.texture_type -> image_data -> unit
+      = "gl_api_glTexImage3D_native"
+  "gl_api_glTexImage3D_bytecode"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetTexImage.xml}
+    manual pages on opengl.org}
+*)
+external glGetTexImage: target:Tex.texture_image_type -> level:int -> format:Tex.teximage_format ->
+  texture_type:Tex.texture_type -> image_data -> unit = "gl_api_glGetTexImage"
+
+module TexSub = Enums.TexSub
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexSubImage1D.xml}
+    manual pages on opengl.org}
+*)
+external glTexSubImage1D: level:int ->
+  xoffset:int -> width:int ->  format:TexSub.texture_format ->
+    texture_type:TexSub.texture_type -> image_data -> unit =
+  "gl_api_glTexSubImage1D_native"
+    "gl_api_glTexSubImage1D_bytecode"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexSubImage2D.xml}
+    manual pages on opengl.org}
+*)
+external glTexSubImage2D: level:int -> xoffset:int -> yoffset:int -> width:int ->
+  height:int ->  format:TexSub.texture_texture ->
+    type_format:TexSub.texture_type -> image_data -> unit =
+  "gl_api_glTexSubImage2D_native"
+    "gl_api_glTexSubImage2D_bytecode"
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glTexSubImage3D.xml}
+    manual pages on opengl.org}
+*)
+external glTexSubImage3D: level:int -> xoffset:int -> yoffset:int -> zoffset:int ->
+  width:int -> height:int -> depth:int ->
+    format:TexSub.texture_format ->
+      texture_type:TexSub.texture_type -> image_data -> unit =
+  "gl_api_glTexSubImage3D_native"
+    "gl_api_glTexSubImage3D_bytecode"
+
+type control_points = (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t
+module GetMap = Enums.GetMap
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glGetMap.xml}
+    manual pages on opengl.org}
+*)
+external glGetMap: target:GetMap.map_target -> query:GetMap.map_query ->
+  points:control_points -> unit = "gl_api_glGetMap"
+
+type index_data = (int, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t
+module DrawRange = Enums.DrawRange
+
+(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glDrawRangeElements.xml}
+    manual pages on opengl.org}
+*)
+external glDrawRangeElements: mode:DrawRange.draw_mode ->
+  range_start:int -> range_end:int -> index_type:DrawRange.index_type ->
+    indices:index_data -> unit = "gl_api_glDrawRangeElements"
+
+(* NOTE: no implementation
+   glGetPointer
+
+   glColorTable
+   glColorSubTable
+   glGetColorTable
+   glGetColorTableParameter
+   glColorTableParameter
+   glGetHistogram
+   glGetHistogramParameter
+   glGetMinmax
+   glGetMinmaxParameter
+   glConvolutionFilter1D
+   glConvolutionFilter2D
+   glGetConvolutionFilter
+   glGetConvolutionParameter
+   glCompressedTexImage1D
+   glCompressedTexImage2D
+   glCompressedTexImage3D
+   glCompressedTexSubImage1D
+   glCompressedTexSubImage2D
+   glCompressedTexSubImage3D
+   glGetCompressedTexImage
+   glCopyColorSubTable
+   glCopyColorTable
+   glMinmax
+   glResetMinmax
+   glClientActiveTexture
 *)
-external glGetCompressedTexImage: glenum -> int -> big_array_type ->
-  unit = "gl_api_glGetCompressedTexImage"
diff --git a/src/gl_api_stubs.c b/src/gl_api_stubs.c
index 75dede6..c3142b1 100644
--- a/src/gl_api_stubs.c
+++ b/src/gl_api_stubs.c
@@ -11,800 +11,467 @@
 #include <caml/bigarray.h>
 #include "common.h"

-#include "gl_enum_convert.h"
 #include "gl_flags.h"

 #define t_prim CAMLprim value

-GLenum ml_camltype_to_gltype(value mltype) {
-  CAMLparam1(mltype);
-  GLenum type = -1;
-
-  switch (mltype) {
-    case MLTAG_Byte: type = GL_BYTE; break;
-    case MLTAG_UByte: type = GL_UNSIGNED_BYTE; break;
-    case MLTAG_Short: type = GL_SHORT; break;
-    case MLTAG_UShort: type = GL_UNSIGNED_SHORT; break;
-    case MLTAG_Int: type = GL_INT; break;
-    case MLTAG_UInt: type = GL_UNSIGNED_INT; break;
-    case MLTAG_Float: type = GL_FLOAT; break;
-    case MLTAG_Double: type = GL_DOUBLE; break;
-    case MLTAG_UByte2: type = GL_2_BYTES; break;
-    case MLTAG_UByte3: type = GL_3_BYTES; break;
-    case MLTAG_UByte4: type = GL_4_BYTES; break;
-    default: break;
-  }
+/* Function implementations */

-  CAMLreturnT(GLenum, type);
-}
+t_prim gl_api_glCallLists(value n, value list_type, value lists) {
+  CAMLparam3(n, list_type, lists);
+  #include "enums/call_list_type.inc"

-value ml_camltype_from_gltype(GLenum type) {
-  CAMLparam0();
-
-  switch (type) {
-    case GL_BYTE:           CAMLreturn(MLTAG_Byte);
-    case GL_UNSIGNED_BYTE:  CAMLreturn(MLTAG_UByte);
-    case GL_SHORT:          CAMLreturn(MLTAG_Short);
-    case GL_UNSIGNED_SHORT: CAMLreturn(MLTAG_UShort);
-    case GL_INT:            CAMLreturn(MLTAG_Int);
-    case GL_UNSIGNED_INT:   CAMLreturn(MLTAG_UInt);
-    case GL_FLOAT:          CAMLreturn(MLTAG_Float);
-    case GL_DOUBLE:         CAMLreturn(MLTAG_Double);
-    case GL_2_BYTES:        CAMLreturn(MLTAG_UByte2);
-    case GL_3_BYTES:        CAMLreturn(MLTAG_UByte3);
-    case GL_4_BYTES:        CAMLreturn(MLTAG_UByte4);
-    default: CAMLreturn(Val_unit);
-  }
+  value ary = Field(lists, 1);
+  glCallLists(Int_val(n), call_list_types[Int_val(list_type)],
+              (const void*)(Caml_ba_array_val(ary)));
+  CAMLreturn(Val_unit);
 }

-value ml_store_array_as_type(void* array, int size, int array_type) {
-  CAMLparam0();
-  CAMLlocal1(ml_array);
-  ml_array = caml_alloc(size, 0);
-
-  switch (array_type) {
-    case BIGARRAY_SINT8:
-    case BIGARRAY_UINT8: {
-      char* array_p = (char*)array;
-      for (int i = 0; i < size; ++i) {
-        Store_field(ml_array, i, Val_int(array_p[i]));
-      }
-      break;
-    }
-    case BIGARRAY_SINT16:
-    case BIGARRAY_UINT16:
-    case BIGARRAY_CAML_INT: {
-      int* array_p = (int*) array;
-      for (int i = 0; i < size; ++i) {
-        Store_field(ml_array, i, Val_int(array_p[i]));
-      }
-      break;
-    }
-    case BIGARRAY_INT32: {
-      unsigned int *array_p = (unsigned int*)array;
-      for (int i = 0; i < size; ++i) {
-      Store_field(ml_array, i, caml_copy_int32(array_p[i]));
-      }
-      break;
-    }
-    case BIGARRAY_INT64: {
-      long long* array_p = (long long*)array;
-      for (int i = 0; i < size; ++i) {
-      Store_field(ml_array, i, caml_copy_int64(array_p[i]));
-      }
-
-      break;
-    }
-    case BIGARRAY_FLOAT32:{
-      float * array_p = (float*)array;
-      for (int i = 0; i < size; ++i) {
-        Store_field(ml_array, i, caml_copy_double(array_p[i]));
-      }
-      break;
-    }
-    case BIGARRAY_FLOAT64: {
-      double * array_p = (double*)array;
-      for (int i = 0; i < size; ++i) {
-        Store_field(ml_array, i, caml_copy_double(array_p[i]));
-      }
-      break;
-  }
-  }
-  CAMLreturn(ml_array);
-}
+t_prim gl_api_glVertexPointer2(value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);
+  #include "enums/vertex_pointer_type.inc"

-/* Caution!: pointer returned from this function must be freed by
-   user!
-*/
-void* ml_malloc_array_by_datatype(GLenum type, int size) {
-  switch (type) {
-    case GL_UNSIGNED_BYTE_3_3_2:
-    case GL_UNSIGNED_BYTE_2_3_3_REV:
-    case GL_UNSIGNED_BYTE:
-      return malloc(sizeof(unsigned char) * size);
-
-    case GL_BYTE:
-      return malloc(sizeof(char) * size);
-    case GL_BITMAP:
-      return malloc(sizeof(unsigned int) * size);
-    case GL_UNSIGNED_SHORT_5_6_5:
-    case GL_UNSIGNED_SHORT_5_6_5_REV:
-    case GL_UNSIGNED_SHORT_4_4_4_4:
-    case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-    case GL_UNSIGNED_SHORT_5_5_5_1:
-    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-    case GL_UNSIGNED_SHORT:
-      return malloc(sizeof(unsigned short) * size);
-    case GL_SHORT:
-      return malloc(sizeof(short) * size);
-    case GL_UNSIGNED_INT_8_8_8_8:
-    case GL_UNSIGNED_INT_8_8_8_8_REV:
-    case GL_UNSIGNED_INT_10_10_10_2:
-    case GL_UNSIGNED_INT_2_10_10_10_REV:
-    case GL_UNSIGNED_INT:
-      return malloc(sizeof(unsigned int) * size);
-    case GL_INT:
-      return malloc(sizeof(int) * size);
-    case GL_FLOAT:
-      return malloc(sizeof(float) * size);
-  }
-  return NULL;
-}
+  glVertexPointer(2, vertex_pointer_types(Int_val(pointer_type)), Int_val(stride),
+                  Caml_ba_array_val(pointer));

-int ml_mapping_datatype_to_bigarray_type(GLenum type) {
-  switch (type) {
-    case GL_UNSIGNED_BYTE_3_3_2:
-    case GL_UNSIGNED_BYTE_2_3_3_REV:
-    case GL_UNSIGNED_BYTE:
-      return BIGARRAY_UINT8;
-    case GL_BYTE:
-      return BIGARRAY_SINT8;
-    case GL_BITMAP:
-      return BIGARRAY_INT32;
-    case GL_UNSIGNED_SHORT_5_6_5:
-    case GL_UNSIGNED_SHORT_5_6_5_REV:
-    case GL_UNSIGNED_SHORT_4_4_4_4:
-    case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-    case GL_UNSIGNED_SHORT_5_5_5_1:
-    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-    case GL_UNSIGNED_SHORT:
-      return BIGARRAY_UINT16;
-    case GL_SHORT:
-      return BIGARRAY_SINT16;
-    case GL_UNSIGNED_INT_8_8_8_8:
-    case GL_UNSIGNED_INT_8_8_8_8_REV:
-    case GL_UNSIGNED_INT_10_10_10_2:
-    case GL_UNSIGNED_INT_2_10_10_10_REV:
-    case GL_UNSIGNED_INT:
-      return BIGARRAY_INT32;
-    case GL_INT:
-      return BIGARRAY_CAML_INT;
-    case GL_FLOAT:
-      return BIGARRAY_FLOAT32;
-  }
-  return 0;
+  CAMLreturn(Val_unit);
 }

-/* Function implementations */
+t_prim gl_api_glVertexPointer3(value size, value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);
+  #include "enums/vertex_pointer_type.inc"

-t_prim gl_api_glCallLists(value n, value lists) {
-  CAMLparam2(n, lists);
-  GLenum type = ml_camltype_to_gltype(Field(lists, 0));
+  glVertexPointer(3, vertex_pointer_types[Int_val(pointer_type)], Int_val(stride),
+                  Caml_ba_array_val(pointer));

-  value ary = Field(lists, 1);
-  glCallLists(Int_val(n), type,
-              (const void*)(Data_bigarray_val(ary)));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glVertexPointer(value size, value stride, value pointer) {
-  CAMLparam3(size, stride, pointer);
+t_prim gl_api_glVertexPointer4(value size, value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);
+  #include "enums/vertex_pointer_type.inc"

-  GLenum type = ml_camltype_to_gltype(Field(pointer, 0));
-  glVertexPointer(Int_val(size), type, Int_val(stride),
-                  Data_bigarray_val(Field(pointer, 1)));
+  glVertexPointer(4, vertex_pointer_types[Int_val(pointer_type)], Int_val(stride),
+                  Caml_ba_array_val(pointer));

   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glNormalPointer(value stride, value pointer) {
-  CAMLparam2(stride, pointer);
+t_prim gl_api_glNormalPointer(value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);
+  #include "enums/normal_pointer_type.inc"

-  glNormalPointer(ml_camltype_to_gltype(Field(pointer, 0)),
+  glNormalPointer(normal_pointer_types[Int_val(pointer_type)],
                   Int_val(stride),
-                  (const void*)(Data_bigarray_val(Field(pointer, 0))));
+                  (const void*)(Caml_ba_array_val(pointer)));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glColorPointer(value size, value stride, value pointer) {
-  CAMLparam3(size, stride, pointer);
+t_prim gl_api_glColorPointer(value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);
+  #include "enums/color_pointer_type.inc"

-  glColorPointer(Int_val(size),
-                 ml_camltype_to_gltype(Field(pointer, 0)),
+  glColorPointer(caml_ba_element_size(pointer),
+                 color_pointer_types[Int_val(pointer_type)],
                  Int_val(stride),
-                 (const void*)(Data_bigarray_val(Field(pointer, 1))));
+                 (const void*)(Caml_ba_array_val(pointer)));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glIndexPointer(value stride, value pointer) {
-  CAMLparam2(stride, pointer);
+t_prim gl_api_glIndexPointer(value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);
+  #include "enums/index_pointer_type.inc"

-  glIndexPointer(ml_camltype_to_gltype(Field(pointer, 0)),
+  glIndexPointer(index_pointer_types[Int_val(pointer_type)],
                  Int_val(stride),
-                 (const void*)(Data_bigarray_val(Field(pointer, 0))));
+                 (const void*)(Caml_ba_array_val(pointer)));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glTexCoordPointer(value size, value stride, value pointer) {
-  CAMLparam3(size, stride, pointer);
+t_prim gl_api_glTexCoordPointer1(value pointer_type, value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);

-  glTexCoordPointer(Int_val(size),
-                    ml_camltype_to_gltype(Field(pointer, 0)),
+  #include "enums/texcoord_pointer_type.inc"
+
+  glTexCoordPointer(1,
+                    texcoord_pointer_types[Int_val(pointer_type)],
                     Int_val(stride),
-                    (const void*)(Data_bigarray_val(Field(pointer, 1))));
+                    (const void*)(Caml_ba_array_val(pointer)));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glEdgeFlagPointer(value stride, value bool_array) {
-  CAMLparam2(stride, bool_array);
+t_prim gl_api_glTexCoordPointer2(value pointer_type , value stride, value pointer) {
+  CAMLparam3(pointer_type, stride, pointer);

-  glEdgeFlagPointer(Int_val(stride),
-                    Data_bigarray_val(Field(bool_array, 1)));
+  #include "enums/texcoord_pointer_type.inc"
+
+  glTexCoordPointer(2,
+                    texcoord_pointer_types[Int_val(pointer_type)],
+                    Int_val(stride),
+                    (const void*)(Caml_ba_array_val(pointer)));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glGetPointerv(value type) {
-  CAMLparam1(type);
-  CAMLlocal1(barray);
+t_prim gl_api_glTexCoordPointer1(value pointer_type , value stride, value pointer) {
+  CAMLparam3(size, stride, pointer);

-  GLenum pointer_type = glenum_ml_to_c(type);
-  GLenum type_array = 0;
-  long size = 0;
-
-  switch (pointer_type) {
-    case GL_COLOR_ARRAY_POINTER:
-      glGetIntegerv(GL_COLOR_ARRAY_TYPE, (GLint*)&type_array);
-      glGetIntegerv(GL_COLOR_ARRAY_SIZE, (GLint*)&size);
-      break;
-    case GL_EDGE_FLAG_ARRAY_POINTER:
-      type_array = GL_INT;
-      size = 1;
-      break;
-    case GL_FOG_COORD_ARRAY_POINTER:
-      glGetIntegerv(GL_FOG_COORD_ARRAY_TYPE, (GLint*)&type_array);
-      size = 1;
-      break;
-    case GL_FEEDBACK_BUFFER_POINTER:
-      glGetIntegerv(GL_FEEDBACK_BUFFER_SIZE, (GLint*)&size);
-      glGetIntegerv(GL_FEEDBACK_BUFFER_TYPE, (GLint*)&type_array);
-      break;
-    case GL_INDEX_ARRAY_POINTER:
-      glGetIntegerv(GL_INDEX_ARRAY_TYPE, (GLint*)&type_array);
-      size = 1;
-      break;
-    case GL_NORMAL_ARRAY_POINTER:
-      glGetIntegerv(GL_NORMAL_ARRAY_TYPE, (GLint*)&type_array);
-      size = 3;
-      break;
-    case GL_SECONDARY_COLOR_ARRAY_POINTER:
-      glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_SIZE, (GLint*)&size);
-      glGetIntegerv(GL_SECONDARY_COLOR_ARRAY_TYPE, (GLint*)&type_array);
-      break;
-    case GL_SELECTION_BUFFER_POINTER:
-      glGetIntegerv(GL_SELECTION_BUFFER_SIZE, (GLint*)&size);
-      type = GL_UNSIGNED_INT;
-      break;
-    case GL_TEXTURE_COORD_ARRAY_POINTER:
-      glGetIntegerv(GL_TEXTURE_COORD_ARRAY_SIZE, (GLint*)&size);
-      glGetIntegerv(GL_TEXTURE_COORD_ARRAY_TYPE, (GLint*)&type_array);
-      break;
-    case GL_VERTEX_ARRAY_POINTER:
-      glGetIntegerv(GL_VERTEX_ARRAY_SIZE, (GLint*)&size);
-      glGetIntegerv(GL_VERTEX_ARRAY_TYPE, (GLint*)&type_array);
-      break;
-  }
+  #include "enums/texcoord_pointer_type.inc"

-  int bigarray_type = 0;
-  switch (type_array) {
-    case GL_BYTE:           bigarray_type = BIGARRAY_SINT8; break;
-    case GL_UNSIGNED_BYTE:  bigarray_type = BIGARRAY_UINT8; break;
-    case GL_SHORT:          bigarray_type = BIGARRAY_SINT16; break;
-    case GL_UNSIGNED_SHORT: bigarray_type = BIGARRAY_UINT16; break;
-    case GL_INT:            bigarray_type = BIGARRAY_CAML_INT; break;
-    case GL_UNSIGNED_INT:   bigarray_type = BIGARRAY_INT32; break;
-    case GL_FLOAT:          bigarray_type = BIGARRAY_FLOAT32; break;
-    case GL_DOUBLE:         bigarray_type = BIGARRAY_FLOAT64; break;
-    case GL_2_BYTES:        bigarray_type = BIGARRAY_SINT8; break;
-    case GL_3_BYTES:        bigarray_type = BIGARRAY_SINT8; break;
-    case GL_4_BYTES:        bigarray_type = BIGARRAY_SINT8; break;
-  }
+  glTexCoordPointer(3,
+                    texcoord_pointer_types[Int_val(pointer_type)],
+                    Int_val(stride),
+                    (const void*)(Caml_ba_array_val(pointer)));
+  CAMLreturn(Val_unit);
+}
+
+t_prim gl_api_glTexCoordPointer4(value pointer_type , value stride, value pointer) {
+  CAMLparam3(size, stride, pointer);
+  #include "enums/texcoord_pointer_type.inc"

-  void* pointer = NULL;
-  glGetPointerv(pointer_type, &pointer);
-  barray = alloc_bigarray(bigarray_type | BIGARRAY_C_LAYOUT,
-                          1, pointer, (long*)&size);
-  CAMLreturn(barray);
+  glTexCoordPointer(4,
+                    texcoord_pointer_types[Int_val(pointer_type)],
+                    Int_val(stride),
+                    (const void*)(Caml_ba_array_val(pointer)));
+  CAMLreturn(Val_unit);
 }

-t_prim gl_api_glDrawElements(value mode, value count, value indices) {
-  CAMLparam3(mode, count, indices);
+t_prim gl_api_glEdgeFlagPointer(value stride, value bool_array) {
+  CAMLparam2(stride, bool_array);

-  GLenum gl_mode = glenum_ml_to_c(mode);
-  GLenum type = ml_camltype_to_gltype(Field(indices, 0));
+  glEdgeFlagPointer(Int_val(stride),
+                    Caml_ba_array_val(bool_array));
+  CAMLreturn(Val_unit);
+}
+
+t_prim gl_api_glDrawElements(value mode, value elements_type, value indices) {
+  CAMLparam3(mode, elements_type, indices);
+  #include "enums/draw_mode.inc"
+  #include "enums/draw_elements_type.inc"

-  glDrawElements(gl_mode, Int_val(count), type,
-                 Data_bigarray_val(Field(indices, 1)));
+  glDrawElements(draw_modes[Int_val(mode)],
+                 caml_ba_element_size(indices),
+                 draw_elements_types[Int_val(elements_type)],
+                 Caml_ba_array_val(indices));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glGetLightfv(value light, value pname) {
-  CAMLparam2(light, pname);
-  CAMLlocal1(val_single);
-
-  GLenum gl_pname = glenum_ml_to_c(pname);
-  switch (gl_pname) {
-    case GL_AMBIENT:
-    case GL_DIFFUSE:
-    case GL_SPECULAR:
-    case GL_POSITION: {
-      const int size = 4;
-      float val[size];
-      glGetLightfv(glenum_ml_to_c(light),
-                   gl_pname,
-                   val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = caml_copy_double(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_SPOT_DIRECTION: {
-      const int size = 3;
-      float val[size];
-      glGetLightfv(glenum_ml_to_c(light),
-                   gl_pname,
-                   val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = caml_copy_double(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_SPOT_EXPONENT:
-    case GL_SPOT_CUTOFF:
-    case GL_CONSTANT_ATTENUATION:
-    case GL_LINEAR_ATTENUATION:
-    case GL_QUADRATIC_ATTENUATION: {
-      float val;
-      glGetLightfv(glenum_ml_to_c(light),
-                   gl_pname,
-                   &val);
-      val_single = caml_alloc(1, 0);
-      Store_field(val_single, 0, caml_copy_double(val));
-      CAMLreturn(val);
-    }
-    default: {
-      val_single = caml_alloc(0, 0);
-      CAMLreturn(val_single);
-    }
-  }
+t_prim gl_api_glGetLight1(value light_i, value variant) {
+  CAMLparam2(light_i, variant);
+  float array[1];
+  #include "enums/get_light.inc"
+
+  glGetLightfv(Int_val(light_i),
+               get_lights[Int_val(variant)],
+               array);
+  CAMLreturn(Val_double(array[0]));
 }

-t_prim gl_api_glGetLightiv(value light, value pname) {
-  CAMLparam2(light, pname);
-  CAMLlocal1(val_single);
-
-  GLenum gl_pname = glenum_ml_to_c(pname);
-  switch (gl_pname) {
-    case GL_AMBIENT:
-    case GL_DIFFUSE:
-    case GL_SPECULAR:
-    case GL_POSITION: {
-      const int size = 4;
-      int val[size];
-      glGetLightiv(glenum_ml_to_c(light),
-                   gl_pname,
-                   val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = Val_int(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_SPOT_DIRECTION: {
-      const int size = 3;
-      int val[size];
-      glGetLightiv(glenum_ml_to_c(light),
-                   gl_pname,
-                   val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = Val_int(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_SPOT_EXPONENT:
-    case GL_SPOT_CUTOFF:
-    case GL_CONSTANT_ATTENUATION:
-    case GL_LINEAR_ATTENUATION:
-    case GL_QUADRATIC_ATTENUATION: {
-      int val;
-      glGetLightiv(glenum_ml_to_c(light),
-                   gl_pname,
-                   &val);
-      val_single = caml_alloc(1, 0);
-      Store_field(val_single, 0, Val_int(val));
-      CAMLreturn(val);
-    }
-    default: {
-      val_single = caml_alloc(0, 0);
-      CAMLreturn(val_single);
-    }
-  }
+t_prim gl_api_glGetLight3(value light_i) {
+  CAMLparam2(light_i, variant);
+  CAMLlocal1(ret);
+  float array[3];
+  #include "enums/get_light.inc"
+
+  glGetLightfv(Int_val(light_i),
+               GL_SPOT_DIRECTION,
+               array);
+  ret = caml_alloc(3 * Double_wosize, Double_array_tag);
+  Store_double_field(ret, 0, array[0]);
+  Store_double_field(ret, 1, array[1]);
+  Store_double_field(ret, 2, array[2]);
+  CAMLreturn(ret);
 }

-t_prim gl_api_glGetMaterialfv(value face, value pname) {
-  CAMLparam2(face, pname);
-  CAMLlocal1(val_single);
-
-  GLenum gl_pname = glenum_ml_to_c(pname);
-  switch (gl_pname) {
-    case GL_AMBIENT:
-    case GL_DIFFUSE:
-    case GL_SPECULAR:
-    case GL_EMISSION: {
-      const int size = 4;
-      float val[size];
-      glGetMaterialfv(glenum_ml_to_c(face),
-                      gl_pname,
-                      val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = caml_copy_double(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_COLOR_INDEXES: {
-      const int size = 3;
-      float val[size];
-      glGetMaterialfv(glenum_ml_to_c(face),
-                      gl_pname,
-                      val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = caml_copy_double(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_SHININESS: {
-      float val;
-      glGetMaterialfv(glenum_ml_to_c(face),
-                      gl_pname,
-                      &val);
-      val_single = caml_alloc(1, 0);
-      Store_field(val_single, 0, caml_copy_double(val));
-      CAMLreturn(val);
-    }
-    default: {
-      val_single = caml_alloc(0, 0);
-      CAMLreturn(val_single);
-    }
-  }
+t_prim gl_api_glGetLight4(value light_i, value variant) {
+  CAMLparam2(light_i, variant);
+  CAMLlocal1(ret);
+  float array[4];
+  #include "enums/get_light.inc"
+
+  glGetLightfv(Int_val(light_i),
+               get_lights[Int_val(variant)],
+               array);
+  ret = caml_alloc(4 * Double_wosize, Double_array_tag);
+  Store_double_field(ret, 0, array[0]);
+  Store_double_field(ret, 1, array[1]);
+  Store_double_field(ret, 2, array[2]);
+  Store_double_field(ret, 3, array[3]);
+  CAMLreturn(ret);
 }

-t_prim gl_api_glGetMaterialiv(value face, value pname) {
+t_prim gl_api_glGetMaterialf1(value face,value pname) {
   CAMLparam2(face, pname);
-  CAMLlocal1(val_single);
-
-  GLenum gl_pname = glenum_ml_to_c(pname);
-  switch (gl_pname) {
-    case GL_AMBIENT:
-    case GL_DIFFUSE:
-    case GL_SPECULAR:
-    case GL_EMISSION: {
-      const int size = 4;
-      int val[size];
-      glGetMaterialiv(glenum_ml_to_c(face),
-                      gl_pname,
-                      val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = Val_int(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_COLOR_INDEXES: {
-      const int size = 3;
-      int val[size];
-      glGetMaterialiv(glenum_ml_to_c(face),
-                      gl_pname,
-                      val);
-      value caml_val[size];
-      for (int i = 0; i < size; ++i) {
-        caml_val[i] = Val_int(val[i]);
-      }
-      CAMLreturn(array_from_c(caml_val, size));
-    }
-    case GL_SHININESS: {
-      int val;
-      glGetMaterialiv(glenum_ml_to_c(face),
-                      gl_pname,
-                      &val);
-      val_single = caml_alloc(1, 0);
-      Store_field(val_single, 0, Val_int(val));
-      CAMLreturn(val);
-    }
-    default: {
-      val_single = caml_alloc(0, 0);
-      CAMLreturn(val_single);
-    }
-  }
+  #include "enums/face_mode.inc"
+  #include "enums/material_1f.inc"
+
+  float val[1];
+  glGetMaterialfv(face_modes[Int_val(face)],
+                  material_1fs[Int_val(pname)],
+                  val);
+  CAMLreturn(Val_double(val[0]));
 }

-t_prim gl_api_glReadPixels_native(value x, value y, value width, value height, value format, value type) {
+t_prim gl_api_glGetMaterialf3(value face,value pname) {
+  CAMLparam2(face, pname);
+  CAMLlocal1(ret);
+  #include "enums/face_mode.inc"
+  #include "enums/material_3f.inc"
+
+  float val[3];
+  glGetMaterialfv(face_modes[Int_val(face)],
+                  material_3fs[Int_val(pname)],
+                  val);
+  ret = caml_alloc(3 * Double_wosize, Double_array_tag);
+  Store_double_field(ret, 0, val[0]);
+  Store_double_field(ret, 1, val[1]);
+  Store_double_field(ret, 2, val[2]);
+  CAMLreturn(ret);
+}
+
+t_prim gl_api_glGetMaterialf4(value face,value pname) {
+  CAMLparam2(face, pname);
+  CAMLlocal1(ret);
+  #include "enums/face_mode.inc"
+  #include "enums/material_4f.inc"
+
+  float val[4];
+  glGetMaterialfv(face_modes[Int_val(face)],
+                  material_4fs[Int_val(pname)],
+                  val);
+  ret = caml_alloc(4 * Double_wosize, Double_array_tag);
+  Store_double_field(ret, 0, val[0]);
+  Store_double_field(ret, 1, val[1]);
+  Store_double_field(ret, 2, val[2]);
+  Store_double_field(ret, 3, val[3]);
+  CAMLreturn(ret);
+}
+
+t_prim gl_api_glReadPixels_native(value x, value y, value width, value height, value format, value pixel_type,
+                                  value pointer) {
   CAMLparam5(x, y, width, height, format);
-  CAMLxparam1(type);
+  CAMLxparam1(pixel_type, pointer);
   CAMLlocal1(barray);
-
-  int size = 0;
-  switch (glenum_ml_to_c(format)) {
-    case GL_COLOR_INDEX:
-    case GL_STENCIL_INDEX:
-    case GL_DEPTH_COMPONENT:
-    case GL_RED:
-    case GL_GREEN:
-    case GL_BLUE:
-    case GL_ALPHA:
-    case GL_LUMINANCE:
-      size = 1;
-      break;
-    case GL_RGB:
-    case GL_BGR:
-      size = 3;
-      break;
-    case GL_RGBA:
-    case GL_BGRA:
-      size = 4;
-      break;
-    case GL_LUMINANCE_ALPHA:
-      size = 2;
-      break;
-  }
-
-  int array_type = ml_mapping_datatype_to_bigarray_type(
-      glenum_ml_to_c(type));
-  void* pointer = ml_malloc_array_by_datatype(
-      glenum_ml_to_c(type), size);
+  #include "enums/read_pixel_format.inc"
+  #include "enums/read_pixel_type.inc"

   glReadPixels(Int_val(x), Int_val(y), Int_val(width), Int_val(height),
-               glenum_ml_to_c(format),
-               glenum_ml_to_c(type),
-               pointer);
-  barray = ml_store_array_as_type(pointer, size, array_type);
-  CAMLreturn(barray);
+               read_pixel_formats[Int_val(format)],
+               read_pixel_types[Int_val(pixel_type)],
+               Caml_ba_data_val(pointer));
+  CAMLreturn(Val_unit);
 }

 t_prim gl_api_glReadPixels_bytecode(value *argv, int argc) {
   return gl_api_glReadPixels_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
+      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);

 }

 t_prim gl_api_glDrawPixels(value width, value height, value format, value type, value data) {
   CAMLparam5(width, height, format, type, data);
+  #include "enums/read_pixel_format.inc"
+  #include "enums/read_pixel_type.inc"

   glDrawPixels(Int_val(width), Int_val(height),
-               glenum_ml_to_c(format),
-               glenum_ml_to_c(type),
-               Data_bigarray_val(data));
+               read_pixel_formats[Int_val(format)],
+               read_pixel_types[Int_val(type)],
+               Caml_ba_data_val(data));

   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glGetTexGendv(value coord, value pname) {
-  CAMLparam2(coord, pname);
-
-  GLenum gl_pname = glenum_ml_to_c(pname);
-  const int size = 4;
-  double val[size];
-  glGetTexGendv(glenum_ml_to_c(coord),
-                gl_pname, val);
-  CAMLreturn(ml_store_array_as_type(val, size, BIGARRAY_FLOAT64));
-}
-
-t_prim gl_api_glGetTexGenfv(value coord, value pname) {
-  CAMLparam2(coord, pname);
+t_prim gl_api_glGetTexGen1(value coord) {
+  CAMLparam1(coord);
+  #include "enums/coord.inc"
+  #include "enums/texgen_func.inc"

-  GLenum gl_pname = glenum_ml_to_c(pname);
-  const int size = 4;
-  float val[size];
-  glGetTexGenfv(glenum_ml_to_c(coord),
-                gl_pname, val);
-  CAMLreturn(ml_store_array_as_type(val, size, BIGARRAY_FLOAT32));
+  GLenum val;
+  glGetTexGeniv(coords[Int_val(coord)],
+                GL_TEXTURE_GEN_MODE, &val);
+  for (int i = 0; i < sizeof(texgen_funcs); ++i) {
+    if (texgen_funcs[i] == val) {
+      CAMLreturn(Val_int(i));
+    }
+  }
 }

-t_prim gl_api_glGetTexGeniv(value coord, value pname) {
+t_prim gl_api_glGetTexGen4(value coord, value pname) {
   CAMLparam2(coord, pname);
+  CAMLlocal1(ret);
+  #include "enums/coord.inc"
+  #include "enums/texgen_plane.inc"

-  GLenum gl_pname = glenum_ml_to_c(pname);
-  const int size = 4;
-  int val[size];
-  glGetTexGeniv(glenum_ml_to_c(coord),
-                gl_pname, val);
-  CAMLreturn(ml_store_array_as_type(val, size, BIGARRAY_CAML_INT));
+  float val[4];
+  glGetTexGenfv(coords[Int_val(coord)],
+                texgen_planes[Int_val(pname)],
+                val);
+  ret = caml_alloc(4 * Double_wosize, Double_array_tag);
+  Store_double_field(ret, 0, val[0]);
+  Store_double_field(ret, 1, val[1]);
+  Store_double_field(ret, 2, val[2]);
+  Store_double_field(ret, 3, val[3]);
+  CAMLreturn(ret);
 }

-t_prim gl_api_glGetTexGenv(value coord) {
-  CAMLparam1(coord);
+t_prim gl_api_glGetTexEnv1(value unit) {
+  CAMLparam1(unit);
+  #include "enums/texgen_env_func.inc"

   GLenum val;
-  glGetTexGeniv(glenum_ml_to_c(coord),
+  glGetTexEnviv(GL_TEXTURE_ENV,
                 GL_TEXTURE_GEN_MODE, &val);
-  CAMLreturn(glenum_c_to_ml(val));
-}
-
-t_prim gl_api_glGetTexEnvfv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  float* val = NULL;
-  int size = 0;
-  GLenum gl_pname = glenum_ml_to_c(pname);
-
-  switch (gl_pname) {
-    case GL_TEXTURE_ENV_COLOR:
-      size = 4;
-      break;
-    default:
-      size = 1;
-      break;
+  for (int i = 0; i < sizeof(texgen_env_funcs); ++i) {
+    if (texgen_env_funcs[i] == val) {
+      CAMLreturn(Val_int(i));
+    }
   }
-
-  val = malloc(sizeof(float) * size);
-  glGetTexEnvfv(glenum_ml_to_c(target),
-                gl_pname,
-                val);
-  value v = ml_store_array_as_type(val, size, BIGARRAY_FLOAT32);
-  free(val);
-  CAMLreturn(v);
 }

-t_prim gl_api_glGetTexEnviv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  int* val = NULL;
-  int size = 0;
-  GLenum gl_pname = glenum_ml_to_c(pname);
-
-  switch (gl_pname) {
-    case GL_TEXTURE_ENV_COLOR:
-      size = 4;
-      break;
-    default:
-      size = 1;
-      break;
-  }
+t_prim gl_api_glGetTexEnv4(value unit) {
+  CAMLparam1(coord);
+  CAMLlocal1(ret);

-  val = malloc(sizeof(int) * size);
-  glGetTexEnviv(glenum_ml_to_c(target),
-                gl_pname,
+  float val[4];
+  glGetTexEnvfv(GL_TEXTURE_ENV,
+                GL_TEXTURE_ENV_COLOR,
                 val);
-  value v = ml_store_array_as_type(val, size, BIGARRAY_CAML_INT);
-  free(val);
-  CAMLreturn(v);
+  ret = caml_alloc(4 * Double_wosize, Double_array_tag);
+  Store_double_field(ret, 0, val[0]);
+  Store_double_field(ret, 1, val[1]);
+  Store_double_field(ret, 2, val[2]);
+  Store_double_field(ret, 3, val[3]);
+  CAMLreturn(ret);
 }

-t_prim gl_api_glGetTexLevelParameterfv(value target, value level, value pname) {
-  CAMLparam3(target, level, pname);
+t_prim gl_api_glGetTexLevelParameter_format(value target, value level) {
+  CAMLparam2(target, level);
+  #include "enums/texlevel_target.inc"
+  #include "enums/internal_format.inc"

-  float v;
-  glGetTexLevelParameterfv(glenum_ml_to_c(target),
+  GLenum val;
+  glGetTexLevelParameteriv(texlevel_targets[Int_val(target)],
                            Int_val(level),
-                           glenum_ml_to_c(pname),
-                           &v);
-
-  CAMLreturn(caml_copy_double(v));
+                           GL_TEXTURE_INTERNAL_FORMAT,
+                           &val);
+  for (int i = 0; i < sizeof(internal_formats; ++i) {
+    if (internal_formats[i] == val) {
+      CAMLreturn(Val_int(i));
+    }
+  }
 }

-t_prim gl_api_glGetTexLevelParameteriv(value target, value level, value pname) {
+t_prim gl_api_glGetTexLevelParameter(value target, value level, value pname) {
   CAMLparam3(target, level, pname);
+  #include "enums/texlevel_target.inc"
+  #include "enums/internal_format.inc"

   int v;
-  glGetTexLevelParameteriv(glenum_ml_to_c(target),
+  glGetTexLevelParameteriv(texlevel_targets[Int_val(target)],
                            Int_val(level),
-                           glenum_ml_to_c(pname),
+                           internal_formats[Int_val(pname)],
                            &v);

   CAMLreturn(Val_int(v));
 }

 t_prim gl_api_glTexImage1D_native(value target, value level, value internal_format,
-                                  value width, value border, value format, value data) {
+                                  value width, value border, value format, value type, value data) {
   CAMLparam5(target, level, internal_format, width, border);
-  CAMLxparam2(format, data);
-
-  GLenum data_type = ml_camltype_to_gltype(Field(data, 0));
-
-  glTexImage1D(glenum_ml_to_c(target),
-               Int_val(level), Int_val(internal_format),
+  CAMLxparam3(format, type, data);
+  #include "enums/image_1d_type.inc"
+  #include "enums/internal_format.inc"
+  #include "enums/texture_format.inc"
+  #include "enums/texture_type.inc"
+
+  glTexImage1D(image_1d_types[Int_val(target)],
+               Int_val(level), internal_formats[Int_val(internal_format)],
                Int_val(width), Int_val(border),
-               glenum_ml_to_c(format),
-               data_type, Data_bigarray_val(Field(data, 1)));
+               texture_formats[Int_val(format)],
+               texture_types[Int_val(type)], Caml_ba_array_val(data));
   CAMLreturn(Val_unit);
 }

 t_prim gl_api_glTexImage1D_bytecode(value *argv, int argc) {
   return gl_api_glTexImage1D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
+      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
 }

 t_prim gl_api_glTexImage2D_native(value target, value level, value internal_format,
                                   value width, value height, value border,
-                                  value format, value data) {
+                                  value format, value type, value data) {
   CAMLparam5(target, level, internal_format, width, border);
-  CAMLxparam3(height, format, data);
-
-  GLenum data_type = ml_camltype_to_gltype(Field(data, 0));
-
-  glTexImage2D(glenum_ml_to_c(target),
-               Int_val(level), Int_val(internal_format),
+  CAMLxparam4(height, format, type, data);
+  #include "enums/image_2d_type.inc"
+  #include "enums/internal_format.inc"
+  #include "enums/texture_format.inc"
+  #include "enums/texture_type.inc"
+
+  glTexImage2D(image_2d_types[Int_val(target)],
+               Int_val(level), internal_formats[Int_val(internal_format)],
                Int_val(width), Int_val(height),
                Int_val(border),
-               glenum_ml_to_c(format),
-               data_type, Data_bigarray_val(Field(data, 1)));
+               texture_formats[Int_val(format)],
+               texture_types[Int_val(type)], Caml_ba_array_val(data));
   CAMLreturn(Val_unit);
 }

 t_prim gl_api_glTexImage2D_bytecode(value *argv, int argc) {
   return gl_api_glTexImage2D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
+      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8]);
 }

 t_prim gl_api_glTexImage3D_native(value target, value level, value internal_format,
                                   value width, value height, value depth, value border,
-                                  value format, value data) {
+                                  value format, value type, value data) {
   CAMLparam5(target, level, internal_format, width, border);
-  CAMLxparam4(height, depth, format, data);
-
-  GLenum data_type = ml_camltype_to_gltype(Field(data, 0));
-
-  glTexImage3D(glenum_ml_to_c(target),
-               Int_val(level), Int_val(internal_format),
+  CAMLxparam5(height, depth, format, data, type);
+  #include "enums/image_3d_type.inc"
+  #include "enums/internal_format.inc"
+  #include "enums/texture_format.inc"
+  #include "enums/texture_type.inc"
+
+  glTexImage3D(image_3d_types[Int_val(target)],
+               Int_val(level), internal_formats[Int_val(internal_format)],
                Int_val(width), Int_val(height), Int_val(depth),
                Int_val(border),
-               glenum_ml_to_c(format),
-               data_type, Data_bigarray_val(Field(data, 1)));
+               texture_formats[Int_val(format)],
+               texture_types[Int_val(type)], Caml_ba_array_val(data));
   CAMLreturn(Val_unit);
 }

 t_prim gl_api_glTexImage3D_bytecode(value *argv, int argc) {
   return gl_api_glTexImage3D_native(
       argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
-      argv[7], argv[8]);
+      argv[7], argv[8], argv[9]);
 }

-t_prim gl_api_glGetTexImage(value target, value level, value format, value data) {
-  CAMLparam4(target, level, format, data);
+t_prim gl_api_glGetTexImage(value target, value level, value format, value type, value data) {
+  CAMLparam5(target, level, format, type, data);
+  #include "enums/texture_image_type.inc"
+  #include "enums/teximage_format.inc"
+  #include "enums/texture_type.inc"

-  glGetTexImage(glenum_ml_to_c(target),
+  glGetTexImage(texture_image_types[Int_val(type)],
                 Int_val(level),
-                glenum_ml_to_c(format),
-                ml_camltype_to_gltype(Field(data, 0)),
-                Data_bigarray_val(Field(data, 1)));
+                teximage_formats[Int_val(format)],
+                texture_types[Int_val(type)],
+                Caml_ba_data_val(data));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glTexSubImage1D_native(value target, value level, value xoffset,
-                                     value width, value format, value data) {
-  CAMLparam5(target, level, xoffset, width, format);
+t_prim gl_api_glTexSubImage1D_native(value level, value xoffset,
+                                     value width, value format, value type, value data) {
+  CAMLparam5(level, xoffset, width, format, type);
   CAMLxparam1(data);
+  #include "enums/texture_format.inc"
+  #include "enums/texture_type.inc"

-  GLenum data_type = ml_camltype_to_gltype(Field(data, 0));
-
-  glTexSubImage1D(glenum_ml_to_c(target),
+  glTexSubImage1D(GL_TEXTURE_1D,
                   Int_val(level), Int_val(xoffset),
                   Int_val(width),
-                  glenum_ml_to_c(format),
-                  data_type, Data_bigarray_val(Field(data, 1)));
+                  texture_formats[Int_val(format)],
+                  texture_type[Int_val(type)],
+                  Caml_ba_data_val(data));
   CAMLreturn(Val_unit);
 }

@@ -813,18 +480,18 @@ t_prim gl_api_glTexSubImage1D_bytecode(value *argv, int argc) {
       argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
 }

-t_prim gl_api_glTexSubImage2D_native(value target, value level, value xoffset, value yoffset,
-                                     value width, value height, value format, value data) {
-  CAMLparam5(target, level, xoffset, yoffset, width);
-  CAMLxparam3(height, format, data);
-
-  GLenum data_type = ml_camltype_to_gltype(Field(data, 0));
+t_prim gl_api_glTexSubImage2D_native(value level, value xoffset, value yoffset,
+                                     value width, value height, value format, value type, value data) {
+  CAMLparam5(level, xoffset, yoffset, width, height);
+  CAMLxparam3(format, type, data);

-  glTexSubImage2D(glenum_ml_to_c(target),
+  glTexSubImage2D(GL_TEXTURE_2D,
                   Int_val(level), Int_val(xoffset), Int_val(yoffset),
                   Int_val(width), Int_val(height),
-                  glenum_ml_to_c(format),
-                  data_type, Data_bigarray_val(Field(data, 1)));
+                  texture_formats[Int_val(format)],
+                  texture_type[Int_val(type)],
+                  Caml_ba_data_val(data));
+
   CAMLreturn(Val_unit);
 }

@@ -834,20 +501,19 @@ t_prim gl_api_glTexSubImage2D_bytecode(value *argv, int argc) {
       argv[6], argv[7]);
 }

-t_prim gl_api_glTexSubImage3D_native(value target, value level,
+t_prim gl_api_glTexSubImage3D_native(value level,
                                      value xoffset, value yoffset, value zoffset,
                                      value width, value height, value depth,
-                                     value format, value data) {
-  CAMLparam5(target, level, xoffset, yoffset, zoffset);
-  CAMLxparam5(width, height, depth, format, data);
-
-  GLenum data_type = ml_camltype_to_gltype(Field(data, 0));
+                                     value format, value type, value data) {
+  CAMLparam5(level, xoffset, yoffset, zoffset, width);
+  CAMLxparam5(height, depth, format, type, data);

-  glTexSubImage3D(glenum_ml_to_c(target),
+  glTexSubImage3D(GL_TEXTURE_3D,
                   Int_val(level), Int_val(xoffset), Int_val(yoffset), Int_val(zoffset),
                   Int_val(width), Int_val(height), Int_val(depth),
-                  glenum_ml_to_c(format),
-                  data_type, Data_bigarray_val(Field(data, 1)));
+                  texture_formats[Int_val(format)],
+                  texture_type[Int_val(type)],
+                  Caml_ba_data_val(data));
   CAMLreturn(Val_unit);
 }

@@ -857,618 +523,24 @@ t_prim gl_api_glTexSubImage3D_bytecode(value *argv, int argc) {
       argv[6], argv[7], argv[8], argv[9]);
 }

-int ml_map_dimensions_of_target(GLenum target) {
-  switch (target) {
-    case GL_MAP1_COLOR_4:
-    case GL_MAP1_INDEX:
-    case GL_MAP1_NORMAL:
-    case GL_MAP1_TEXTURE_COORD_1:
-    case GL_MAP1_TEXTURE_COORD_2:
-    case GL_MAP1_TEXTURE_COORD_3:
-    case GL_MAP1_TEXTURE_COORD_4:
-    case GL_MAP1_VERTEX_3:
-    case GL_MAP1_VERTEX_4:
-      return 1;
-    case GL_MAP2_COLOR_4:
-    case GL_MAP2_INDEX:
-    case GL_MAP2_NORMAL:
-    case GL_MAP2_TEXTURE_COORD_1:
-    case GL_MAP2_TEXTURE_COORD_2:
-    case GL_MAP2_TEXTURE_COORD_3:
-    case GL_MAP2_TEXTURE_COORD_4:
-    case GL_MAP2_VERTEX_3:
-    case GL_MAP2_VERTEX_4:
-      return 2;
-  }
-}
-
-int ml_point_size_of_target(GLenum target) {
-  switch (target) {
-    case GL_MAP1_INDEX:
-    case GL_MAP1_TEXTURE_COORD_1:
-    case GL_MAP2_INDEX:
-    case GL_MAP2_TEXTURE_COORD_1:
-      return 1;
-    case GL_MAP1_TEXTURE_COORD_2:
-    case GL_MAP2_TEXTURE_COORD_2:
-      return 2;
-    case GL_MAP1_VERTEX_3:
-    case GL_MAP1_NORMAL:
-    case GL_MAP1_TEXTURE_COORD_3:
-    case GL_MAP2_VERTEX_3:
-    case GL_MAP2_NORMAL:
-    case GL_MAP2_TEXTURE_COORD_3:
-      return 3;
-    case GL_MAP1_TEXTURE_COORD_4:
-    case GL_MAP1_COLOR_4:
-    case GL_MAP1_VERTEX_4:
-    case GL_MAP2_TEXTURE_COORD_4:
-    case GL_MAP2_COLOR_4:
-    case GL_MAP2_VERTEX_4:
-      return 4;
-  }
-}
-
-int ml_calc_map_size(int orders[], int dimensions, int point_size) {
-  if (dimensions == 1) {
-    return orders[0] * point_size;
-  } else {
-    return (orders[0] * orders[1]) * point_size;
-  }
-}
-
-t_prim gl_api_glGetMapdv(value target, value query) {
-  CAMLparam2(target, query);
-
-  GLenum gl_target = glenum_ml_to_c(target);
-  GLenum gl_query = glenum_ml_to_c(query);
-
-  switch (gl_query) {
-    case GL_ORDER: {
-      const int size = ml_map_dimensions_of_target(gl_target);
-      double val[size];
-
-      glGetMapdv(gl_target, gl_query, val);
-      CAMLreturn(ml_store_array_as_type(val, size,
-                                        BIGARRAY_FLOAT64));
-    }
-    case GL_DOMAIN: {
-      const int size = ml_map_dimensions_of_target(gl_target) * 2;
-      double val[size];
-      glGetMapdv(gl_target, gl_query, val);
-      CAMLreturn(ml_store_array_as_type(val, size,
-                                        BIGARRAY_FLOAT64));
-    }
-    case GL_COEFF: {
-      const int dimension_order = ml_map_dimensions_of_target(gl_target);
-      int orders[dimension_order];
-      glGetMapiv(gl_target, GL_ORDER, orders);
-      const int val_size = ml_calc_map_size(orders, dimension_order,
-                                            ml_point_size_of_target(gl_target));
-
-      double *val = malloc(sizeof(double) * val_size);
-      glGetMapdv(gl_target, gl_query, val);
-      value retval = ml_store_array_as_type(val, val_size, BIGARRAY_FLOAT64);
-      free(val);
-      CAMLreturn(retval);
-    }
-  }
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glGetMapfv(value target, value query) {
-  CAMLparam2(target, query);
-
-  GLenum gl_target = glenum_ml_to_c(target);
-  GLenum gl_query = glenum_ml_to_c(query);
-
-  switch (gl_query) {
-    case GL_ORDER: {
-      const int size = ml_map_dimensions_of_target(gl_target);
-      float val[size];
-
-      glGetMapfv(gl_target, gl_query, val);
-      CAMLreturn(ml_store_array_as_type(val, size,
-                                        BIGARRAY_FLOAT32));
-    }
-    case GL_DOMAIN: {
-      const int size = ml_map_dimensions_of_target(gl_target) * 2;
-      float val[size];
-      glGetMapfv(gl_target, gl_query, val);
-      CAMLreturn(ml_store_array_as_type(val, size,
-                                        BIGARRAY_FLOAT32));
-    }
-    case GL_COEFF: {
-      const int dimension_order = ml_map_dimensions_of_target(gl_target);
-      int orders[dimension_order];
-      glGetMapiv(gl_target, GL_ORDER, orders);
-      const int val_size = ml_calc_map_size(orders, dimension_order,
-                                            ml_point_size_of_target(gl_target));
-
-      float *val = malloc(sizeof(float) * val_size);
-      glGetMapfv(gl_target, gl_query, val);
-      value retval = ml_store_array_as_type(val, val_size, BIGARRAY_FLOAT32);
-      free(val);
-      CAMLreturn(retval);
-    }
-  }
+t_prim gl_api_glGetMap(value target, value query, value points) {
+  CAMLparam3(target, query, points);
+  #include "enums/map_target.inc"
+  #include "enums/map_query.inc"
+  glGetMapdv(map_targets[Int_val(target)],
+             map_query[Int_val(query)],
+             Caml_ba_data_val(points));
   CAMLreturn(Val_unit);
 }

-t_prim gl_api_glGetMapiv(value target, value query) {
-  CAMLparam2(target, query);
-
-  GLenum gl_target = glenum_ml_to_c(target);
-  GLenum gl_query = glenum_ml_to_c(query);
+t_prim gl_api_glDrawRangeElements(value mode, value start, value end, value type, value indices) {
+  CAMLparam5(mode, start, end, type, indices);
+  #include "enums/draw_mode.inc"
+  #include "enums/index_type.inc"

-  switch (gl_query) {
-    case GL_ORDER: {
-      const int size = ml_map_dimensions_of_target(gl_target);
-      int val[size];
-
-      glGetMapiv(gl_target, gl_query, val);
-      CAMLreturn(ml_store_array_as_type(val, size,
-                                        BIGARRAY_CAML_INT));
-    }
-    case GL_DOMAIN: {
-      const int size = ml_map_dimensions_of_target(gl_target) * 2;
-      int val[size];
-      glGetMapiv(gl_target, gl_query, val);
-      CAMLreturn(ml_store_array_as_type(val, size,
-                                        BIGARRAY_CAML_INT));
-    }
-    case GL_COEFF: {
-      const int dimension_order = ml_map_dimensions_of_target(gl_target);
-      int orders[dimension_order];
-      glGetMapiv(gl_target, GL_ORDER, orders);
-      const int val_size = ml_calc_map_size(orders, dimension_order,
-                                            ml_point_size_of_target(gl_target));
-
-      int *val = malloc(sizeof(int) * val_size);
-      glGetMapiv(gl_target, gl_query, val);
-      value retval = ml_store_array_as_type(val, val_size, BIGARRAY_CAML_INT);
-      free(val);
-      CAMLreturn(retval);
-    }
-  }
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glDrawRangeElements(value mode, value start, value end, value count, value indices) {
-  CAMLparam5(mode, start, end, count, indices);
-
-  glDrawRangeElements(glenum_ml_to_c(mode),
+  glDrawRangeElements(draw_mode[Int_val(mode)],
                       Int_val(start), Int_val(end), Int_val(count),
-                      ml_camltype_to_gltype(Field(indices, 0)),
-                      Data_bigarray_val(Field(indices, 1)));
-
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glColorTable(value target, value internal_format, value width,
-                           value format, value data) {
-  CAMLparam5(target, internal_format, width, format, data);
-
-  glColorTable(glenum_ml_to_c(target),
-               glenum_ml_to_c(internal_format),
-               Int_val(width),
-               glenum_ml_to_c(format),
-               ml_camltype_to_gltype(Field(data, 0)),
-               Data_bigarray_val(Field(data, 1)));
-
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glColorSubTable(value target, value start, value count,
-                              value format, value data) {
-  CAMLparam5(target, start, count, format, data);
-
-  glColorSubTable(glenum_ml_to_c(target),
-                  Int_val(start), Int_val(count),
-                  glenum_ml_to_c(format),
-                  ml_camltype_to_gltype(Field(data, 0)),
-                  Data_bigarray_val(Field(data, 1)));
-
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glGetColorTable(value target, value format, value type, value data) {
-  CAMLparam4(target, format, type, data);
-
-  glGetColorTable(glenum_ml_to_c(target),
-                  glenum_ml_to_c(format),
-                  glenum_ml_to_c(type),
-                  Data_bigarray_val(Field(data, 1)));
-
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glGetColorTableParameterfv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  int data_size = 0;
-  switch (glenum_ml_to_c(target)) {
-    case GL_COLOR_TABLE:
-    case GL_POST_CONVOLUTION_COLOR_TABLE:
-    case GL_POST_COLOR_MATRIX_COLOR_TABLE:
-    case GL_PROXY_COLOR_TABLE:
-    case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
-    case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: {
-      switch (glenum_ml_to_c(pname)) {
-        case GL_COLOR_TABLE_SCALE:
-        case GL_COLOR_TABLE_BIAS:
-          data_size = 4;
-          break;
-        default:
-          data_size = 1;
-          break;
-      }
-      break;
-    }
-    default:
-      data_size = 1;
-      break;
-  }
-
-  float *val = malloc(sizeof(float) * data_size);
-  glGetColorTableParameterfv(
-      glenum_ml_to_c(target),
-      glenum_ml_to_c(pname),
-      val);
-
-  value retval = ml_store_array_as_type(val, data_size, BIGARRAY_FLOAT32);
-  free(val);
-  CAMLreturn(retval);
-}
-
-t_prim gl_api_glGetColorTableParameteriv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  int data_size = 0;
-  switch (glenum_ml_to_c(target)) {
-    case GL_COLOR_TABLE:
-    case GL_POST_CONVOLUTION_COLOR_TABLE:
-    case GL_POST_COLOR_MATRIX_COLOR_TABLE:
-    case GL_PROXY_COLOR_TABLE:
-    case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
-    case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: {
-      switch (glenum_ml_to_c(pname)) {
-        case GL_COLOR_TABLE_SCALE:
-        case GL_COLOR_TABLE_BIAS:
-          data_size = 4;
-          break;
-        default:
-          data_size = 1;
-          break;
-      }
-      break;
-    }
-    default:
-      data_size = 1;
-      break;
-  }
-
-  int *val = malloc(sizeof(int) * data_size);
-  glGetColorTableParameteriv(
-      glenum_ml_to_c(target),
-      glenum_ml_to_c(pname),
-      val);
-
-  value retval = ml_store_array_as_type(val, data_size, BIGARRAY_CAML_INT);
-  free(val);
-  CAMLreturn(retval);
-}
-
-t_prim gl_api_glGetHistogram(value target, value reset, value format, value type,
-                             value data) {
-  CAMLparam5(target, reset, format, type, data);
-
-  int gl_reset = GL_FALSE;
-  if (reset == Val_true) {
-    gl_reset = GL_TRUE;
-  }
-
-  glGetHistogram(glenum_ml_to_c(target),
-                 gl_reset,
-                 glenum_ml_to_c(format),
-                 ml_camltype_to_gltype(Field(data, 0)),
-                 Data_bigarray_val(Field(data, 1)));
-
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glGetHistogramParameterfv(value target, value pname) {
-  CAMLparam2(target, pname);
-  float val;
-  glGetHistogramParameterfv(glenum_ml_to_c(target),
-                            glenum_ml_to_c(pname),
-                            &val);
-  CAMLreturn(caml_copy_double(val));
-}
-
-t_prim gl_api_glGetHistogramParameteriv(value target, value pname) {
-  CAMLparam2(target, pname);
-  int val;
-  glGetHistogramParameteriv(glenum_ml_to_c(target),
-                            glenum_ml_to_c(pname),
-                            &val);
-  CAMLreturn(Val_int(val));
-}
-
-t_prim gl_api_glGetMinmax(value target, value reset, value format, value data) {
-  CAMLparam4(target, reset, format, data);
-
-  int gl_reset = GL_FALSE;
-  if (reset == Val_true) {
-    gl_reset = GL_TRUE;
-  }
-
-  glGetMinmax(glenum_ml_to_c(target),
-              gl_reset,
-              glenum_ml_to_c(format),
-              ml_camltype_to_gltype(Field(data, 0)),
-              Data_bigarray_val(Field(data, 1)));
-
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glGetMinmaxParameterfv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  float val;
-  glGetMinmaxParameterfv(glenum_ml_to_c(target),
-                         glenum_ml_to_c(pname),
-                         &val);
-  CAMLreturn(caml_copy_double(val));
-}
-
-t_prim gl_api_glGetMinmaxParameteriv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  int val;
-  glGetMinmaxParameteriv(glenum_ml_to_c(target),
-                         glenum_ml_to_c(pname),
-                         &val);
-  CAMLreturn(Val_int(val));
-}
-
-t_prim gl_api_glConvolutionFilter1D(value target, value internal_format,
-                                    value width, value format, value data) {
-  CAMLparam5(target, internal_format, width, format, data);
-
-  glConvolutionFilter1D(glenum_ml_to_c(target),
-                        glenum_ml_to_c(internal_format),
-                        Int_val(width),
-                        glenum_ml_to_c(format),
-                        ml_camltype_to_gltype(Field(data, 0)),
-                        Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glConvolutionFilter2D_native(value target, value internal_format,
-                                           value width, value height, value format, value data) {
-  CAMLparam5(target, internal_format, width, format, data);
-  CAMLxparam1(height);
-
-  glConvolutionFilter2D(glenum_ml_to_c(target),
-                        glenum_ml_to_c(internal_format),
-                        Int_val(width), Int_val(height),
-                        glenum_ml_to_c(format),
-                        ml_camltype_to_gltype(Field(data, 0)),
-                        Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glConvolutionFilter2D_bytecode(value *argv, int argc) {
-  return gl_api_glConvolutionFilter2D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
-}
-
-t_prim gl_api_glGetConvolutionFilter(value target, value format, value data) {
-  CAMLparam3(target, format, data);
-
-  glGetConvolutionFilter(glenum_ml_to_c(target),
-                         glenum_ml_to_c(format),
-                         ml_camltype_to_gltype(Field(data, 0)),
-                         Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glGetConvolutionParameterfv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  int data_size = 0;
-  switch (glenum_ml_to_c(pname)) {
-    case GL_CONVOLUTION_BORDER_MODE:
-    case GL_CONVOLUTION_FORMAT:
-    case GL_CONVOLUTION_WIDTH:
-    case GL_CONVOLUTION_HEIGHT:
-    case GL_MAX_CONVOLUTION_WIDTH:
-    case GL_MAX_CONVOLUTION_HEIGHT:
-      data_size = 1;
-      break;
-    case GL_CONVOLUTION_BORDER_COLOR:
-    case GL_CONVOLUTION_FILTER_BIAS:
-      data_size = 4;
-      break;
-  }
-
-  float *data = malloc(sizeof(float) * data_size);
-  glGetConvolutionParameterfv(glenum_ml_to_c(target),
-                              glenum_ml_to_c(pname),
-                              data);
-  value retval = ml_store_array_as_type(data, data_size,
-                                        BIGARRAY_FLOAT32);
-  free(data);
-  CAMLreturn(retval);
-}
-
-t_prim gl_api_glGetConvolutionParameteriv(value target, value pname) {
-  CAMLparam2(target, pname);
-
-  int data_size = 0;
-  switch (glenum_ml_to_c(pname)) {
-    case GL_CONVOLUTION_BORDER_MODE:
-    case GL_CONVOLUTION_FORMAT:
-    case GL_CONVOLUTION_WIDTH:
-    case GL_CONVOLUTION_HEIGHT:
-    case GL_MAX_CONVOLUTION_WIDTH:
-    case GL_MAX_CONVOLUTION_HEIGHT:
-      data_size = 1;
-      break;
-    case GL_CONVOLUTION_BORDER_COLOR:
-    case GL_CONVOLUTION_FILTER_BIAS:
-      data_size = 4;
-      break;
-  }
-
-  int *data = malloc(sizeof(int) * data_size);
-  glGetConvolutionParameteriv(glenum_ml_to_c(target),
-                              glenum_ml_to_c(pname),
-                              data);
-  value retval = ml_store_array_as_type(data, data_size,
-                                        BIGARRAY_CAML_INT);
-  free(data);
-  CAMLreturn(retval);
-}
-
-t_prim gl_api_glCompressedTexImage1D_native(value target, value level,
-                                            value internal_format, value width,
-                                            value border, value imagesize, value data) {
-  CAMLparam5(target, level, internal_format, width, border);
-  CAMLxparam2(imagesize, data);
-
-  glCompressedTexImage1D(glenum_ml_to_c(target),
-                         Int_val(level),
-                         glenum_ml_to_c(internal_format),
-                         Int_val(width), Int_val(border),
-                         Int_val(imagesize),
-                         Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glCompressedTexImage1D_bytecode(value *argv, int argc) {
-  return gl_api_glCompressedTexImage1D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
-}
-
-t_prim gl_api_glCompressedTexImage2D_native(value target, value level,
-                                            value internal_format, value width, value height,
-                                            value border, value imagesize, value data) {
-  CAMLparam5(target, level, internal_format, width, height);
-  CAMLxparam3(border, imagesize, data);
-
-  glCompressedTexImage2D(glenum_ml_to_c(target),
-                         Int_val(level),
-                         glenum_ml_to_c(internal_format),
-                         Int_val(width), Int_val(height), Int_val(border),
-                         Int_val(imagesize),
-                         Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glCompressedTexImage2D_bytecode(value *argv, int argc) {
-  return gl_api_glCompressedTexImage2D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
-      argv[7]);
-}
-
-t_prim gl_api_glCompressedTexImage3D_native(value target, value level,
-                                            value internal_format, value width, value height,
-                                            value depth,
-                                            value border, value imagesize, value data) {
-  CAMLparam5(target, level, internal_format, width, height);
-  CAMLxparam4(depth, border, imagesize, data);
-
-  glCompressedTexImage3D(glenum_ml_to_c(target),
-                         Int_val(level),
-                         glenum_ml_to_c(internal_format),
-                         Int_val(width), Int_val(height), Int_val(width),
-                         Int_val(border), Int_val(imagesize),
-                         Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glCompressedTexImage3D_bytecode(value *argv, int argc) {
-  return gl_api_glCompressedTexImage3D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
-      argv[7], argv[8]);
-}
-
-t_prim gl_api_glCompressedTexSubImage1D_native(value target, value level,
-                                               value xoffset, value width,
-                                               value format,
-                                               value imagesize, value data) {
-  CAMLparam5(target, level, xoffset, width, format);
-  CAMLxparam2(imagesize, data);
-
-  glCompressedTexSubImage1D(glenum_ml_to_c(target),
-                            Int_val(level), Int_val(xoffset),
-                            Int_val(width),
-                            glenum_ml_to_c(format),
-                            Int_val(imagesize),
-                            Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glCompressedTexSubImage1D_bytecode(value *argv, int argc) {
-  return gl_api_glCompressedTexSubImage1D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
-}
-
-t_prim gl_api_glCompressedTexSubImage2D_native(value target, value level,
-                                               value xoffset, value yoffset,
-                                               value width, value height,
-                                               value format,
-                                               value imagesize, value data) {
-  CAMLparam5(target, level, xoffset, yoffset, width);
-  CAMLxparam4(height, format, imagesize, data);
-
-  glCompressedTexSubImage2D(glenum_ml_to_c(target),
-                            Int_val(level), Int_val(xoffset), Int_val(yoffset),
-                            Int_val(width), Int_val(height),
-                            glenum_ml_to_c(format),
-                            Int_val(imagesize),
-                            Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glCompressedTexSubImage2D_bytecode(value *argv, int argc) {
-  return gl_api_glCompressedTexSubImage2D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
-      argv[7], argv[8]);
-}
-
-t_prim gl_api_glCompressedTexSubImage3D_native(value target, value level,
-                                               value xoffset, value yoffset, value zoffset,
-                                               value width, value height, value depth,
-                                               value format,
-                                               value imagesize, value data) {
-  CAMLparam5(target, level, xoffset, yoffset, zoffset);
-  CAMLxparam5(width, height, depth, format, imagesize);
-  CAMLxparam1(data);
-
-  glCompressedTexSubImage3D(glenum_ml_to_c(target),
-                            Int_val(level), Int_val(xoffset), Int_val(yoffset),
-                            Int_val(zoffset),
-                            Int_val(width), Int_val(height), Int_val(depth),
-                            glenum_ml_to_c(format),
-                            Int_val(imagesize),
-                            Data_bigarray_val(Field(data, 1)));
-  CAMLreturn(Val_unit);
-}
-
-t_prim gl_api_glCompressedTexSubImage3D_bytecode(value *argv, int argc) {
-  return gl_api_glCompressedTexSubImage3D_native(
-      argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
-      argv[7], argv[8], argv[9], argv[10]);
-}
-
-t_prim gl_api_glGetCompressedTexImage(value target, value lod, value data) {
-  CAMLparam3(target, lod, data);
-
-  glGetCompressedTexImage(glenum_ml_to_c(target),
-                          Int_val(lod),
-                          Data_bigarray_val(Field(data, 1)));
+                      index_type[Int_val(type)],
+                      Caml_ba_data_val(indices));
   CAMLreturn(Val_unit);
 }
[from now] 2012/11/26 16:40:56

diff --git a/src/enum_list.xml b/src/enum_list.xml
new file mode 100644
index 0000000..0a67f0f
--- /dev/null
+++ b/src/enum_list.xml
@@ -0,0 +1,1435 @@
+<glenumlists>
+  <!-- These enum lists are used to convert .ml or .c then it include some sources.  -->
+  <!-- Lists of enum has equivalence structure.
+       Tag of 'section' start a list of enums, it have one attribute of 'name' is
+       name of section and type name.
+       Tag of pname is a enum name into the section, it have one attribute of 'version'
+       is able to use version for OpenGL.
+  -->
+
+  <!-- Enums for Lighting operations -->
+  <section name="get_light">
+    <modules>
+      <module>Light</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_AMBIENT</pname>
+    <pname version="GL_VERSION_0_0">GL_DIFFUSE</pname>
+    <pname version="GL_VERSION_0_0">GL_SPECULAR</pname>
+    <pname version="GL_VERSION_0_0">GL_POSITION</pname>
+    <pname version="GL_VERSION_0_0">GL_SPOT_DIRECTION</pname>
+    <pname version="GL_VERSION_0_0">GL_SPOT_EXPONENT</pname>
+    <pname version="GL_VERSION_0_0">GL_SPOT_CUTOFF</pname>
+    <pname version="GL_VERSION_0_0">GL_CONSTANT_ATTENUATION</pname>
+    <pname version="GL_VERSION_0_0">GL_LINEAR_ATTENUATION</pname>
+    <pname version="GL_VERSION_0_0">GL_QUADRATIC_ATTENUATION</pname>
+  </section>
+
+  <section name="set_light_1">
+    <modules>
+      <module>Light</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_SPOT_DIRECTION</pname>
+    <pname version="GL_VERSION_0_0">GL_SPOT_EXPONENT</pname>
+    <pname version="GL_VERSION_0_0">GL_SPOT_CUTOFF</pname>
+    <pname version="GL_VERSION_0_0">GL_CONSTANT_ATTENUATION</pname>
+    <pname version="GL_VERSION_0_0">GL_LINEAR_ATTENUATION</pname>
+    <pname version="GL_VERSION_0_0">GL_QUADRATIC_ATTENUATION</pname>
+  </section>
+
+  <section name="set_light_4">
+    <modules>
+      <module>Light</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_AMBIENT</pname>
+    <pname version="GL_VERSION_0_0">GL_DIFFUSE</pname>
+    <pname version="GL_VERSION_0_0">GL_SPECULAR</pname>
+    <pname version="GL_VERSION_0_0">GL_POSITION</pname>
+  </section>
+
+  <section name="light_model">
+    <modules>
+      <module>Light</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_LIGHT_MODEL_AMBIENT</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT_MODEL_LOCAL_VIEWER</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT_MODEL_TWO_SIDE</pname>
+  </section>
+
+  <section name="light_model_control">
+    <modules>
+      <module>Light</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_SEPARATE_SPECULAR_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_SINGLE_COLOR</pname>
+  </section>
+
+  <!-- Enums for face_mode -->
+  <section name="face_mode">
+    <modules>
+      <module>Material</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FRONT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK</pname>
+  </section>
+
+  <!-- Enums for Material -->
+  <section name="set_material">
+    <modules>
+      <module>Material</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_AMBIENT</pname>
+    <pname version="GL_VERSION_0_0">GL_DIFFUSE</pname>
+    <pname version="GL_VERSION_0_0">GL_SPECULAR</pname>
+    <pname version="GL_VERSION_0_0">GL_EMISSION</pname>
+    <pname version="GL_VERSION_0_0">GL_SHININESS</pname>
+    <pname version="GL_VERSION_0_0">GL_AMBIENT_AND_DIFFUSE</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_INDEXES</pname>
+  </section>
+
+  <section name="material_4f">
+    <modules>
+      <module>Material</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_AMBIENT</pname>
+    <pname version="GL_VERSION_0_0">GL_DIFFUSE</pname>
+    <pname version="GL_VERSION_0_0">GL_SPECULAR</pname>
+    <pname version="GL_VERSION_0_0">GL_EMISSION</pname>
+  </section>
+
+  <section name="material_3f">
+    <modules>
+      <module>Material</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR_INDEXES</pname>
+  </section>
+
+  <section name="material_1f">
+    <modules>
+      <module>Material</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_SHININESS</pname>
+  </section>
+
+  <!-- for Pixels -->
+  <section name="read_pixel_format">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_COMPONENT</pname>
+    <pname version="GL_VERSION_0_0">GL_RED</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB</pname>
+    <pname version="GL_VERSION_0_0">GL_BGR</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA</pname>
+    <pname version="GL_VERSION_0_0">GL_BGRA</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE_ALPHA</pname>
+  </section>
+
+  <section name="read_pixel_type">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_BITMAP</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE_3_3_2</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE_2_3_3_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_5_6_5</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_5_6_5_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_4_4_4_4</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_4_4_4_4_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_5_5_5_1</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_1_5_5_5_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_8_8_8_8</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_8_8_8_8_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_10_10_10_2</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_2_10_10_10_REV</pname>
+  </section>
+
+  <section name="pixel_store_boolean">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_PACK_SWAP_BYTES</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_LSB_FIRST</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SWAP_BYTES</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_LSB_FIRST</pname>
+  </section>
+
+  <section name="pixel_store_integer">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_PACK_ROW_LENGTH</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_IMAGE_HEIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SKIP_ROWS</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SKIP_PIXELS</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SKIP_IMAGES</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_ROW_LENGTH</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_IMAGE_HEIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SKIP_ROWS</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SKIP_PIXELS</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SKIP_IMAGES</pname>
+  </section>
+
+  <section name="pixel_store_align">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_PACK_ALIGNMENT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_ALIGNMENT</pname>
+  </section>
+
+  <section name="pixel_transfer_boolean">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP_STENCIL</pname>
+  </section>
+
+  <section name="pixel_transfer_integer">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_INDEX_SHIFT</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_OFFSET</pname>
+  </section>
+
+  <section name="pixel_transfer_float">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_RED_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_RED_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_RED_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_GREEN_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_BLUE_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_ALPHA_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_RED_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_GREEN_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_BLUE_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_ALPHA_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_RED_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_GREEN_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_BLUE_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_ALPHA_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_RED_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_GREEN_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_BLUE_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_ALPHA_BIAS</pname>
+  </section>
+
+  <section name="pixel_map">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_A_TO_A_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_B_TO_B_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_G_TO_G_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_A_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_B_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_G_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_I_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_R_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_R_TO_R_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_S_TO_S_SIZE</pname>
+  </section>
+
+  <section name="pixel_copy_type">
+    <modules>
+      <module>Pixels</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL</pname>
+  </section>
+
+  <section name="stencil_op">
+    <modules>
+      <module>Stencil</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_KEEP</pname>
+    <pname version="GL_VERSION_0_0">GL_ZERO</pname>
+    <pname version="GL_VERSION_0_0">GL_REPLACE</pname>
+    <pname version="GL_VERSION_0_0">GL_INCR</pname>
+    <pname version="GL_VERSION_0_0">GL_DECR</pname>
+    <pname version="GL_VERSION_0_0">GL_INVERT</pname>
+  </section>
+
+  <section name="coord">
+    <modules>
+      <module>Coord</module>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_S</pname>
+    <pname version="GL_VERSION_0_0">GL_T</pname>
+    <pname version="GL_VERSION_0_0">GL_R</pname>
+    <pname version="GL_VERSION_0_0">GL_Q</pname>
+  </section>
+
+  <section name="texgen_plane">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_OBJECT_PLANE</pname>
+    <pname version="GL_VERSION_0_0">GL_EYE_PLANE</pname>
+  </section>
+
+  <section name="texgen_func">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_OBJECT_LINEAR</pname>
+    <pname version="GL_VERSION_0_0">GL_EYE_LINEAR</pname>
+    <pname version="GL_VERSION_0_0">GL_SPHERE_MAP</pname>
+  </section>
+
+  <section name="texgen_env_func">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MODULATE</pname>
+    <pname version="GL_VERSION_0_0">GL_DECAL</pname>
+    <pname version="GL_VERSION_0_0">GL_BLEND</pname>
+    <pname version="GL_VERSION_0_0">GL_REPLACE</pname>
+  </section>
+
+  <section name="convolution_target">
+    <modules>
+      <module>Convolution</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_SEPARABLE_2D</pname>
+  </section>
+
+  <section name="convolution_border_mode">
+    <modules>
+      <module>Convolution</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CONSTANT_BORDER</pname>
+    <pname version="GL_VERSION_0_0">GL_REDUCE</pname>
+    <pname version="GL_VERSION_0_0">GL_REPLICATE_BORDER</pname>
+  </section>
+
+  <section name="convolution_pname">
+    <modules>
+      <module>Convolution</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_BORDER_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_FILTER_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_FILTER_BIAS</pname>
+  </section>
+
+  <section name="texlevel_target">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_3D</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_TEXTURE_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_TEXTURE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_TEXTURE_3D</pname>
+  </section>
+
+  <section name="texlevel_pname">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_WIDTH</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_HEIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BORDER</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_RED_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GREEN_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BLUE_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_ALPHA_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_LUMINANCE_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_INTENSITY_SIZE</pname>
+  </section>
+
+  <section name="image_1d_type">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_TEXTURE_1D</pname>
+  </section>
+
+  <section name="image_2d_type">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_TEXTURE_2D</pname>
+  </section>
+
+  <section name="image_3d_type">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_3D</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_TEXTURE_3D</pname>
+  </section>
+
+  <section name="texture_image_type">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_3D</pname>
+  </section>
+
+  <section name="internal_format">
+    <modules>
+      <module>Tex</module>
+      <module>Histogram</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA4</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA8</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA12</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA16</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE4</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE8</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE12</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE16</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE4_ALPHA4</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE6_ALPHA2</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE8_ALPHA8</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE12_ALPHA4</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE12_ALPHA12</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE16_ALPHA16</pname>
+    <pname version="GL_VERSION_0_0">GL_INTENSITY</pname>
+    <pname version="GL_VERSION_0_0">GL_INTENSITY4</pname>
+    <pname version="GL_VERSION_0_0">GL_INTENSITY8</pname>
+    <pname version="GL_VERSION_0_0">GL_INTENSITY12</pname>
+    <pname version="GL_VERSION_0_0">GL_INTENSITY16</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB</pname>
+    <pname version="GL_VERSION_0_0">GL_R3_G3_B2</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB4</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB5</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB8</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB10</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB12</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB16</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA2</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA4</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB5_A1</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA8</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB10_A2</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA12</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA16</pname>
+  </section>
+
+  <section name="texture_format">
+    <modules>
+      <module>Tex</module>
+      <module>TexSub</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_RED</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_RGB</pname>
+    <pname version="GL_VERSION_0_0">GL_BGR</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA</pname>
+    <pname version="GL_VERSION_0_0">GL_BGRA</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE</pname>
+    <pname version="GL_VERSION_0_0">GL_LUMINANCE_ALPHA</pname>
+  </section>
+
+  <section name="texture_type">
+    <modules>
+      <module>Tex</module>
+      <module>TexSub</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_BITMAP</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE_3_3_2</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE_2_3_3_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_5_6_5</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_5_6_5_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_4_4_4_4</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_4_4_4_4_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_5_5_5_1</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT_1_5_5_5_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_8_8_8_8</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_8_8_8_8_REV</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_10_10_10_2</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT_2_10_10_10_REV</pname>
+  </section>
+
+  <section name="tex_parameter_1">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MIN_FILTER</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MAG_FILTER</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MIN_LOD</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MAX_LOD</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BASE_LEVEL</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MAX_LEVEL</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_PRIORITY</pname>
+  </section>
+
+  <section name="tex_parameter_filter">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MIN_FILTER</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MAG_FILTER</pname>
+  </section>
+
+  <section name="tex_parameter_filter_type">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_NEAREST</pname>
+    <pname version="GL_VERSION_0_0">GL_LINEAR</pname>
+    <pname version="GL_VERSION_0_0">GL_NEAREST_MIPMAP_NEAREST</pname>
+    <pname version="GL_VERSION_0_0">GL_LINEAR_MIPMAP_NEAREST</pname>
+    <pname version="GL_VERSION_0_0">GL_NEAREST_MIPMAP_LINEAR</pname>
+    <pname version="GL_VERSION_0_0">GL_LINEAR_MIPMAP_LINEAR</pname>
+  </section>
+
+  <section name="tex_parameter_wrap">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_WRAP_S</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_WRAP_T</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_WRAP_R</pname>
+  </section>
+
+  <section name="tex_parameter_wrap_type">
+    <modules>
+      <module>Tex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CLAMP</pname>
+    <pname version="GL_VERSION_0_0">GL_CLAMP_TO_EDGE</pname>
+    <pname version="GL_VERSION_0_0">GL_REPEAT</pname>
+  </section>
+
+  <!-- maps -->
+  <section name="map_target">
+    <modules>
+      <module>GetMap</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP1_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_1</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_2</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_1</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_2</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_4</pname>
+  </section>
+
+  <section name="map_target_1_1">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP1_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_1</pname>
+  </section>
+
+  <section name="map_target_1_3">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_3</pname>
+  </section>
+
+  <section name="map_target_1_4">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP1_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_4</pname>
+  </section>
+
+  <section name="map_target_2_1">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP2_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_1</pname>
+  </section>
+
+  <section name="map_target_2_3">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_3</pname>
+  </section>
+
+  <section name="map_target_2_4">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MAP2_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_4</pname>
+  </section>
+
+  <section name="mesh_mode_1">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_POINT</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE</pname>
+  </section>
+
+  <section name="mesh_mode_2">
+    <modules>
+      <module>Eval</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_POINT</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE</pname>
+    <pname version="GL_VERSION_0_0">GL_FILL</pname>
+  </section>
+
+  <section name="map_query">
+    <modules>
+      <module>GetMap</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COEFF</pname>
+    <pname version="GL_VERSION_0_0">GL_ORDER</pname>
+    <pname version="GL_VERSION_0_0">GL_DOMAIN</pname>
+  </section>
+
+  <section name="fog_mode">
+    <modules>
+      <module>Fog</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_LINEAR</pname>
+    <pname version="GL_VERSION_0_0">GL_EXP</pname>
+    <pname version="GL_VERSION_0_0">GL_EXP2</pname>
+  </section>
+
+  <section name="fog_value_type">
+    <modules>
+      <module>Fog</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FOG_DENSITY</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_START</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_END</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_INDEX</pname>
+  </section>
+
+  <section name="draw_mode">
+    <modules>
+      <module>DrawRange</module>
+      <module>DrawElements</module>
+      <module>Begin</module>
+      <module>DrawArrays</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_POINTS</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_STRIP</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_LOOP</pname>
+    <pname version="GL_VERSION_0_0">GL_LINES</pname>
+    <pname version="GL_VERSION_0_0">GL_TRIANGLE_STRIP</pname>
+    <pname version="GL_VERSION_0_0">GL_TRIANGLE_FAN</pname>
+    <pname version="GL_VERSION_0_0">GL_TRIANGLES</pname>
+    <pname version="GL_VERSION_0_0">GL_QUAD_STRIP</pname>
+    <pname version="GL_VERSION_0_0">GL_QUADS</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON</pname>
+  </section>
+
+  <section name="call_list_type">
+    <modules>
+      <module>CallList</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_2_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_3_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_4_BYTE</pname>
+  </section>
+
+  <section name="vertex_pointer_type">
+    <modules>
+      <module>Vertex</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_DOUBLE</pname>
+  </section>
+
+  <section name="normal_pointer_type">
+    <modules>
+      <module>Normal</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_DOUBLE</pname>
+  </section>
+
+  <section name="color_pointer_type">
+    <modules>
+      <module>Color</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_DOUBLE</pname>
+  </section>
+
+  <section name="index_pointer_type">
+    <modules>
+      <module>Index</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_DOUBLE</pname>
+  </section>
+
+  <section name="texcoord_pointer_type">
+    <modules>
+      <module>TexCoord</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_INT</pname>
+    <pname version="GL_VERSION_0_0">GL_FLOAT</pname>
+    <pname version="GL_VERSION_0_0">GL_DOUBLE</pname>
+  </section>
+
+  <section name="draw_elements_type">
+    <modules>
+      <module>DrawElements</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT</pname>
+  </section>
+
+  <section name="clear_mask">
+    <modules>
+      <module>Clear</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_BYTE</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_SHORT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNSIGNED_INT</pname>
+  </section>
+
+  <section name="compare_func">
+    <modules>
+      <module>Func</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_NEVER</pname>
+    <pname version="GL_VERSION_0_0">GL_LESS</pname>
+    <pname version="GL_VERSION_0_0">GL_EQUAL</pname>
+    <pname version="GL_VERSION_0_0">GL_LEQUAL</pname>
+    <pname version="GL_VERSION_0_0">GL_GREATER</pname>
+    <pname version="GL_VERSION_0_0">GL_NOTEQUAL</pname>
+    <pname version="GL_VERSION_0_0">GL_GEQUAL</pname>
+    <pname version="GL_VERSION_0_0">GL_ALWAYS</pname>
+  </section>
+
+  <section name="blend_func">
+    <modules>
+      <module>Func</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FUNC_ADD</pname>
+    <pname version="GL_VERSION_0_0">GL_FUNC_SUBTRACT</pname>
+    <pname version="GL_VERSION_0_0">GL_FUNC_REVERSE_SUBTRACT</pname>
+    <pname version="GL_VERSION_0_0">GL_MIN</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX</pname>
+  </section>
+
+  <section name="blend_src_func">
+    <modules>
+      <module>Func</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ZERO</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE</pname>
+    <pname version="GL_VERSION_0_0">GL_DST_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE_MINUS_DST_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_SRC_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE_MINUS_SRC_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_DST_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE_MINUS_DST_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_SRC_ALPHA_SATURATE</pname>
+  </section>
+
+  <section name="blend_dst_func">
+    <modules>
+      <module>Func</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ZERO</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE</pname>
+    <pname version="GL_VERSION_0_0">GL_SRC_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE_MINUS_SRC_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_SRC_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE_MINUS_SRC_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_DST_ALPHA</pname>
+    <pname version="GL_VERSION_0_0">GL_ONE_MINUS_DST_ALPHA</pname>
+  </section>
+
+  <section name="logic_opcode">
+    <modules>
+      <module>Op</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CLEAR</pname>
+    <pname version="GL_VERSION_0_0">GL_SET</pname>
+    <pname version="GL_VERSION_0_0">GL_COPY</pname>
+    <pname version="GL_VERSION_0_0">GL_COPY_INVERTED</pname>
+    <pname version="GL_VERSION_0_0">GL_NOOP</pname>
+    <pname version="GL_VERSION_0_0">GL_INVERT</pname>
+    <pname version="GL_VERSION_0_0">GL_AND</pname>
+    <pname version="GL_VERSION_0_0">GL_NAND</pname>
+    <pname version="GL_VERSION_0_0">GL_OR</pname>
+    <pname version="GL_VERSION_0_0">GL_NOR</pname>
+    <pname version="GL_VERSION_0_0">GL_XOR</pname>
+    <pname version="GL_VERSION_0_0">GL_EQUIV</pname>
+    <pname version="GL_VERSION_0_0">GL_AND_REVERSE</pname>
+    <pname version="GL_VERSION_0_0">GL_AND_INVERTED</pname>
+    <pname version="GL_VERSION_0_0">GL_OR_REVERSE</pname>
+    <pname version="GL_VERSION_0_0">GL_OR_INVERTED</pname>
+  </section>
+
+  <section name="histogram">
+    <modules>
+      <module>Histogram</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_HISTOGRAM</pname>
+    <pname version="GL_VERSION_0_0">GL_PROXY_HISTOGRAM</pname>
+  </section>
+
+  <section name="cull_face_mode">
+    <modules>
+      <module>CullFace</module>
+      <module>Poly</module>
+      <module>Material</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FRONT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT_AND_BACK</pname>
+  </section>
+
+  <section name="ccw">
+    <modules>
+      <module>FrontFace</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CCW</pname>
+    <pname version="GL_VERSION_0_0">GL_CW</pname>
+  </section>
+
+  <section name="clip_plane">
+    <modules>
+      <module>ClipPlane</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE0</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE1</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE2</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE3</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE4</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE5</pname>
+  </section>
+
+  <section name="poly_face_mode">
+    <modules>
+      <module>Poly</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_POINT</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE</pname>
+    <pname version="GL_VERSION_0_0">GL_FILL</pname>
+  </section>
+
+  <section name="draw_buffer_mode">
+    <modules>
+      <module>Buffer</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_NONE</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT_LEFT</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT_RIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK_LEFT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK_RIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK</pname>
+    <pname version="GL_VERSION_0_0">GL_LEFT</pname>
+    <pname version="GL_VERSION_0_0">GL_RIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT_AND_BACK</pname>
+  </section>
+
+  <section name="read_buffer_mode">
+    <modules>
+      <module>Buffer</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FRONT_LEFT</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT_RIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK_LEFT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK_RIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_FRONT</pname>
+    <pname version="GL_VERSION_0_0">GL_BACK</pname>
+    <pname version="GL_VERSION_0_0">GL_LEFT</pname>
+    <pname version="GL_VERSION_0_0">GL_RIGHT</pname>
+  </section>
+
+  <section name="enable_mode">
+    <modules>
+      <module>Enable</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_AUTO_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_BLEND</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE0</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE1</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE2</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE3</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE4</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE5</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_LOGIC_OP</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_MATERIAL</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_CULL_FACE</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_DITHER</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG</pname>
+    <pname version="GL_VERSION_0_0">GL_HISTOGRAM</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_LOGIC_OP</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT0</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT1</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT2</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT3</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT4</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT5</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHTING</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_SMOOTH</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_STIPPLE</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_1</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_2</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_1</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_2</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MINMAX</pname>
+    <pname version="GL_VERSION_0_0">GL_NORMALIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_SMOOTH</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_FILL</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_LINE</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_POINT</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_SMOOTH</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_STIPPLE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_COLOR_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_COLOR_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_RESCALE_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_SEPARABLE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_SCISSOR_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_3D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_Q</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_R</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_S</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_T</pname>
+  </section>
+
+
+  <section name="client_state_mode">
+    <modules>
+      <module>Enable</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_EDGE_FLAG_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_NORMAL_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_COORD_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_VERTEX_ARRAY</pname>
+  </section>
+
+  <section name="get_boolean_1">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_AUTO_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_BLEND</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE0</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE1</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE2</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE3</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE4</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIP_PLANE5</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_LOGIC_OP</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_MATERIAL</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_CONVOLUTION_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_CULL_FACE</pname>
+    <pname version="GL_VERSION_0_0">GL_GL_CURRENT_RASTER_POSITION_VALID</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_WRITEMASK</pname>
+    <pname version="GL_VERSION_0_0">GL_DITHER</pname>
+    <pname version="GL_VERSION_0_0">GL_DOUBLEBUFFER</pname>
+    <pname version="GL_VERSION_0_0">GL_EDGE_FLAG</pname>
+    <pname version="GL_VERSION_0_0">GL_EDGE_FLAG_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG</pname>
+    <pname version="GL_VERSION_0_0">GL_HISTOGRAM</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_LOGIC_OP</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_MODE</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT0</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT1</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT2</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT3</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT4</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT5</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHTING</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT_MODEL_LOCAL_VIEWER</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT_MODEL_TWO_SIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_SMOOTH</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_STIPPLE</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_1</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_2</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_TEXTURE_COORD_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_COLOR_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_1</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_2</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_TEXTURE_COORD_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_3</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_VERTEX_4</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP_STENCIL</pname>
+    <pname version="GL_VERSION_0_0">GL_MINMAX</pname>
+    <pname version="GL_VERSION_0_0">GL_NORMAL_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_NORMALIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_LSB_FIRST</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SWAP_BYTES</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_SMOOTH</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_FILL</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_LINE</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_POINT</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_SMOOTH</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_STIPPLE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_COLOR_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_COLOR_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_RESCALE_NORMAL</pname>
+    <pname version="GL_VERSION_0_0">GL_RGBA_MODE</pname>
+    <pname version="GL_VERSION_0_0">GL_SCISSOR_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_SEPARABLE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_TEST</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_3D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_COORD_ARRAY</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_Q</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_R</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_S</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_GEN_T</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_LSB_FIRST</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SWAP_BYTES</pname>
+    <pname version="GL_VERSION_0_0">GL_VERTEX_ARRAY</pname>
+  </section>
+
+  <section name="get_boolean_4">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR_WRITEMASK</pname>
+  </section>
+
+  <section name="get_value_1">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ACCUM_ALPHA_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_ACCUM_BLUE_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_ACCUM_GREEN_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_ACCUM_RED_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_ALPHA_TEST_REF</pname>
+    <pname version="GL_VERSION_0_0">GL_ATTRIB_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_AUX_BUFFERS</pname>
+    <pname version="GL_VERSION_0_0">GL_BLEND_DST</pname>
+    <pname version="GL_VERSION_0_0">GL_BLEND_EQUATION</pname>
+    <pname version="GL_VERSION_0_0">GL_BLEND_SRC</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_BLUE_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIENT_ATTRIB_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_ARRAY_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_ARRAY_STRIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_ARRAY_TYPE</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_MATRIX_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_RASTER_DISTANCE</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_RASTER_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_CLEAR_VALUE</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_EDGE_FLAG_ARRAY_STRIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_FEEDBACK_BUFFER_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_DENSITY</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_END</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_START</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_GREEN_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_ARRAY_STRIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_CLEAR_VALUE</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_OFFSET</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_SHIFT</pname>
+    <pname version="GL_VERSION_0_0">GL_INDEX_WRITEMASK</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_STIPPLE_PATTERN</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_STIPPLE_REPEAT</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_WIDTH</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_WIDTH_GRANULARITY</pname>
+    <pname version="GL_VERSION_0_0">GL_LIST_BASE</pname>
+    <pname version="GL_VERSION_0_0">GL_LIST_INDEX</pname>
+    <pname version="GL_VERSION_0_0">GL_LIST_MODE</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_GRID_SEGMENTS</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_CLIENT_ATTRIB_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_ATTRIB_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_CLIP_PLANES</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_COLOR_MATRIX_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_ELEMENTS_INDICES</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_ELEMENTS_VERTICES</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_EVAL_ORDER</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_LIGHTS</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_LIST_NESTING</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_MODELVIEW_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_NAME_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_PIXEL_MAP_TABLE</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_PROJECTION_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_TEXTURE_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_MODELVIEW_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_NAME_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_NORMAL_ARRAY_STRIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_ALIGNMENT</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_IMAGE_HEIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_ROW_LENGTH</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SKIP_IMAGES</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SKIP_PIXELS</pname>
+    <pname version="GL_VERSION_0_0">GL_PACK_SKIP_ROWS</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_A_TO_A_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_B_TO_B_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_G_TO_G_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_A_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_B_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_G_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_I_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_I_TO_R_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_R_TO_R_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MAP_S_TO_S_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_SIZE_GRANULARITY</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_FACTOR</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_OFFSET_UNITS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_RED_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_GREEN_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_BLUE_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_ALPHA_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_RED_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_GREEN_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_BLUE_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_COLOR_MATRIX_ALPHA_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_RED_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_GREEN_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_BLUE_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_ALPHA_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_RED_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_GREEN_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_BLUE_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_POST_CONVOLUTION_ALPHA_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_PROJECTION_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_RED_BIAS</pname>
+    <pname version="GL_VERSION_0_0">GL_RED_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_RED_SCALE</pname>
+    <pname version="GL_VERSION_0_0">GL_SELECTION_BUFFER_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_SMOOTH_LINE_WIDTH_RANGE</pname>
+    <pname version="GL_VERSION_0_0">GL_SMOOTH_LINE_WIDTH_GRANULARITY</pname>
+    <pname version="GL_VERSION_0_0">GL_SMOOTH_POINT_SIZE_GRANULARITY</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_CLEAR_VALUE</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_REF</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_VALUE_MASK</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_WRITEMASK</pname>
+    <pname version="GL_VERSION_0_0">GL_SUBPIXEL_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BINDING_1D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BINDING_2D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BINDING_3D</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_COORD_ARRAY_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_COORD_ARRAY_STRIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_STACK_DEPTH</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_ALIGNMENT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_IMAGE_HEIGHT</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_ROW_LENGTH</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SKIP_IMAGES</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SKIP_PIXELS</pname>
+    <pname version="GL_VERSION_0_0">GL_UNPACK_SKIP_ROWS</pname>
+    <pname version="GL_VERSION_0_0">GL_VERTEX_ARRAY_SIZE</pname>
+    <pname version="GL_VERSION_0_0">GL_VERTEX_ARRAY_STRIDE</pname>
+    <pname version="GL_VERSION_0_0">GL_ZOOM_X</pname>
+    <pname version="GL_VERSION_0_0">GL_ZOOM_Y</pname>
+  </section>
+
+  <section name="get_value_2">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ALIASED_POINT_SIZE_RANGE</pname>
+    <pname version="GL_VERSION_0_0">GL_ALIASED_LINE_WIDTH_RANGE</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_RANGE</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_WIDTH_RANGE</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP1_GRID_DOMAIN</pname>
+    <pname version="GL_VERSION_0_0">GL_MAX_VIEWPORT_DIMS</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_SIZE_RANGE</pname>
+    <pname version="GL_VERSION_0_0">GL_SMOOTH_POINT_SIZE_RANGE</pname>
+  </section>
+
+  <section name="get_value_3">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_NORMAL</pname>
+  </section>
+
+  <section name="get_value_4">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_BLEND_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_CLEAR_VALUE</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_RASTER_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_RASTER_POSITION</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_RASTER_TEXTURE_COORDS</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_TEXTURE_COORDS</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_COLOR</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHT_MODEL_AMBIENT</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_GRID_DOMAIN</pname>
+    <pname version="GL_VERSION_0_0">GL_MAP2_GRID_SEGMENTS</pname>
+    <pname version="GL_VERSION_0_0">GL_SCISSOR_BOX</pname>
+    <pname version="GL_VERSION_0_0">GL_VIEWPORT</pname>
+    <pname version="GL_VERSION_0_0"></pname>
+  </section>
+
+  <section name="get_matrix">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COLOR_MATRIX</pname>
+    <pname version="GL_VERSION_0_0">GL_MODELVIEW_MATRIX</pname>
+    <pname version="GL_VERSION_0_0">GL_PROJECTION_MATRIX</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_MATRIX</pname>
+  </section>
+
+  <section name="attrib_mask">
+    <modules>
+      <module>Attrib</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ACCUM_BUFFER_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR_BUFFER_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_CURRENT_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_DEPTH_BUFFER_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_ENABLE_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_EVAL_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_FOG_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_HINT_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_LIGHTING_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_LIST_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_PIXEL_MODE_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_STIPPLE_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_SCISSOR_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_STENCIL_BUFFER_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_TRANSFORM_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_VIEWPORT_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_ALL_ATTRIB_BITS</pname>
+  </section>
+
+  <section name="client_attrib_mask">
+    <modules>
+      <module>Attrib</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_CLIENT_ALL_ATTRIB_BITS</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIENT_PIXEL_STORE_BIT</pname>
+    <pname version="GL_VERSION_0_0">GL_CLIENT_VERTEX_ARRAY_BIT</pname>
+  </section>
+
+  <section name="render_mode">
+    <modules>
+      <module>Render</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_RENDER</pname>
+    <pname version="GL_VERSION_0_0">GL_SELECT</pname>
+    <pname version="GL_VERSION_0_0">GL_FEEDBACK</pname>
+  </section>
+
+  <section name="get_error">
+    <modules>
+      <module>Error</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_NO_ERROR</pname>
+    <pname version="GL_VERSION_0_0">GL_INVALID_ENUM</pname>
+    <pname version="GL_VERSION_0_0">GL_INVALID_VALUE</pname>
+    <pname version="GL_VERSION_0_0">GL_INVALID_OPERATION</pname>
+    <pname version="GL_VERSION_0_0">GL_STACK_OVERFLOW</pname>
+    <pname version="GL_VERSION_0_0">GL_STACK_UNDERFLOW</pname>
+    <pname version="GL_VERSION_0_0">GL_OUT_OF_MEMORY</pname>
+    <pname version="GL_VERSION_0_0">GL_TABLE_TOO_LARGE</pname>
+  </section>
+
+  <section name="get_string">
+    <modules>
+      <module>Get</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_VENDOR</pname>
+    <pname version="GL_VERSION_0_0">GL_RENDERER</pname>
+    <pname version="GL_VERSION_0_0">GL_VERSION</pname>
+    <pname version="GL_VERSION_0_0">GL_EXTENSIONS</pname>
+  </section>
+
+
+  <section name="hint_target">
+    <modules>
+      <module>Hint</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FOG_HINT</pname>
+    <pname version="GL_VERSION_0_0">GL_LINE_SMOOTH_HINT</pname>
+    <pname version="GL_VERSION_0_0">GL_PERSPECTIVE_CORRECTION_HINT</pname>
+    <pname version="GL_VERSION_0_0">GL_POINT_SMOOTH_HINT</pname>
+    <pname version="GL_VERSION_0_0">GL_POLYGON_SMOOTH_HINT</pname>
+  </section>
+
+  <section name="hint_mode">
+    <modules>
+      <module>Hint</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FASTEST</pname>
+    <pname version="GL_VERSION_0_0">GL_NICEST</pname>
+    <pname version="GL_VERSION_0_0">GL_DONT_CARE</pname>
+  </section>
+
+  <section name="accum_op">
+    <modules>
+      <module>Accum</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_ACCUM</pname>
+    <pname version="GL_VERSION_0_0">GL_LOAD</pname>
+    <pname version="GL_VERSION_0_0">GL_ADD</pname>
+    <pname version="GL_VERSION_0_0">GL_MULT</pname>
+    <pname version="GL_VERSION_0_0">GL_RETURN</pname>
+  </section>
+
+  <section name="matrix_mode">
+    <modules>
+      <module>Matrix</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_MODELVIEW</pname>
+    <pname version="GL_VERSION_0_0">GL_PROJECTION</pname>
+    <pname version="GL_VERSION_0_0">GL_TEXTURE</pname>
+    <pname version="GL_VERSION_0_0">GL_COLOR</pname>
+  </section>
+
+  <section name="newlist_mode">
+    <modules>
+      <module>NewList</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_COMPILE</pname>
+    <pname version="GL_VERSION_0_0">GL_COMPILE_AND_EXECUTE</pname>
+  </section>
+
+  <section mode="shade_mode">
+    <modules>
+      <module>Shade</module>
+    </modules>
+    <pname version="GL_VERSION_0_0">GL_FLAT</pname>
+    <pname version="GL_VERSION_0_0">GL_SMOOTH</pname>
+  </section>
+
+</glenumlists>
[from now] 2012/11/26 20:47:28

diff --git a/src/gl_api.ml b/src/gl_api.ml
index c9da188..b8590fb 100644
--- a/src/gl_api.ml
+++ b/src/gl_api.ml
@@ -112,11 +112,6 @@ external glGetPolygonStipple : unit -> (int, Bigarray.int8_unsigned_elt, Bigarra
 *)
 external glEdgeFlag : bool -> unit = "gl_auto_glEdgeFlag"

-(** {{:http://www.opengl.org/sdk/docs/man/xhtml/glEdgeFlagv.xml}
-    manual pages on opengl.org}
-*)
-external glEdgeFlagv: unit -> bool = "gl_auto_glEdgeFlagv"
-
 (** {{:http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml}
     manual pages on opengl.org}
 *)
@@ -134,7 +129,7 @@ external glClipPlane : plane:ClipPlane.clip_plane ->

 type clip_plane_i = GL_CILP_PLANE of int

-external glClipPlanei : plane:clip_plane_i ->
+external _glClipPlanei : plane:int ->
   equaltion:(float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
     = "gl_auto_glClipPlanei"

@@ -143,7 +138,7 @@ let glClipPlanei ~plane ~equaltion =
   | GL_CLIP_PLANE i -> glClipPlanei ~plane:i ~equaltion

 external glGetClipPlane : ClipPlane.clip_plane ->
-  (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t
+  (float, Bigarray.float64_elt, Bigarray.c_layout) Bigarray.Array1.t -> unit
   = "gl_auto_glGetClipPlane"

 type aux_buffer = GL_AUX of int
diff --git a/src/gl_api_stubs.c b/src/gl_api_stubs.c
index c3142b1..faed8b5 100644
--- a/src/gl_api_stubs.c
+++ b/src/gl_api_stubs.c
@@ -15,6 +15,210 @@

 #define t_prim CAMLprim value

+t_prim camlidl_gl_auto_glClearIndex(value _v_c) {
+  CAMLparam1(_v_c);
+  glClearIndex(Double_val(_v_c));
+  CAMLreturn(Val_unit);
+}
+
+
+t_prim camlidl_gl_auto_glClearColor(value _v_red, value _v_green, value _v_blue,
+                                   value _v_alpha) {
+  CAMLparam4(_v_red, _v_green, _v_blue, _v_alpha);
+  float red; /*in*/
+  float green; /*in*/
+  float blue; /*in*/
+  float alpha; /*in*/
+  red = Double_val(_v_red);
+  green = Double_val(_v_green);
+  blue = Double_val(_v_blue);
+  alpha = Double_val(_v_alpha);
+  glClearColor(red, green, blue, alpha);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glClear(value _v_mask) {
+  CAMLparam1(_v_mask);
+  #include "enums/clear_mask.inc"
+
+  glClear(clear_mask[Int_val(_v_mask)]);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glIndexMask(value _v_mask) {
+  CAMLparam1(_v_mask);
+  glIndexMask(Int_val(_v_mask));
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glColorMask(value _v_red, value _v_green, value _v_blue,
+                                   value _v_alpha) {
+  CAMLparam4(_v_red, _v_green, _v_blue, _v_alpha);
+  unsigned char red; /*in*/
+  unsigned char green; /*in*/
+  unsigned char blue; /*in*/
+  unsigned char alpha; /*in*/
+  red = Int_val(_v_red);
+  green = Int_val(_v_green);
+  blue = Int_val(_v_blue);
+  alpha = Int_val(_v_alpha);
+  glColorMask(red, green, blue, alpha);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glAlphaFunc(value _v_func, value _v_ref) {
+  CAMLparam2(_v_func, _v_ref);
+  #include "enums/compare_func.inc"
+  glAlphaFunc(compare_func[Int_val(_v_func)],
+              Double_val(_v_ref));
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glBlendFunc(value _v_sfactor, value _v_dfactor) {
+  CAMLparam2(_v_sfactor, _v_dfactor);
+  #include "enums/blend_src_func.inc"
+  #include "enums/blend_dst_func.inc"
+
+  glBlendFunc(blend_src_func[Int_val(_v_sfactor)],
+              blend_dst_func[Int_val(_v_dfactor)]);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glLogicOp(value _v_opcode) {
+  CAMLparam1(_v_opcode);
+  #include "enums/logic_opcode.inc"
+
+  glLogicOp(logic_opcode[Int_val(_v_opcode)]);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glCullFace(value _v_mode) {
+  CAMLparam1(_v_mode);
+  #include "enums/cull_face_mode.inc"
+
+  glCullFace(cull_face_mode[Int_val(_v_mode)]);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glFrontFace(value _v_mode) {
+  CAMLparam1(_v_mode);
+  #include "enums/ccw.inc"
+  glFrontFace(ccw[Int_val(_v_mode)]);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glPointSize(value _v_size) {
+  CAMLparam1(_v_size);
+
+  float size = Double_val(_v_size);
+  glPointSize(size);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glLineWidth(value _v_width) {
+  CAMLparam1(_v_width);
+  float width; /*in*/
+  width = Double_val(_v_width);
+  glLineWidth(width);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glLineStipple(value _v_factor, value _v_pattern) {
+  CAMLparam2(_v_factor, _v_pattern);
+  int factor; /*in*/
+  unsigned short pattern; /*in*/
+  factor = Int_val(_v_factor);
+  pattern = Int_val(_v_pattern);
+  glLineStipple(factor, pattern);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glPolygonMode(value _v_face, value _v_mode) {
+  CAMLparam2(_v_face, _v_mode);
+  #include "enums/cull_face_mode.inc"
+  #include "enums/poly_face_mode.inc"
+
+  glPolygonMode(cull_face_mode[Int_val(_v_face)],
+                poly_face_mode[Int_val(_v_mode)]);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glPolygonOffset(value _v_factor, value _v_units) {
+  CAMLparam2(_v_factor, _v_units);
+  float factor; /*in*/
+  float units; /*in*/
+  factor = Double_val(_v_factor);
+  units = Double_val(_v_units);
+  glPolygonOffset(factor, units);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glPolygonStipple(value _v_mask) {
+  CAMLparam1(_v_mask);
+  glPolygonStipple(Caml_ba_data_val(_v_mask));
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glGetPolygonStipple(value _unit) {
+  CAMLparam1(_unit);
+  CAMLlocal1(_vres);
+  unsigned char *mask; /*out*/
+
+  mask = stat_alloc(128 * sizeof(unsigned char ));
+  glGetPolygonStipple(mask);
+  _vres = alloc_bigarray_dims(
+      BIGARRAY_UINT8 | BIGARRAY_C_LAYOUT | BIGARRAY_MANAGED,
+      1, mask, 128);
+  CAMLreturn(_vres);
+}
+
+t_prim camlidl_gl_auto_glEdgeFlag(value _v_flag) {
+  CAMLparam1(_v_flag);
+  int flag = Int_val(_v_flag);
+  glEdgeFlag(flag);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glScissor(value _v_x, value _v_y, value _v_width, value _v_height) {
+  CAMLparam4(_v_x, _v_y, _v_width, _v_height);
+  int x; /*in*/
+  int y; /*in*/
+  int width; /*in*/
+  int height; /*in*/
+  x = Int_val(_v_x);
+  y = Int_val(_v_y);
+  width = Int_val(_v_width);
+  height = Int_val(_v_height);
+  glScissor(x, y, width, height);
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glClipPlane(value _v_plane, value _v_equation) {
+  CAMLparam2(_v_plane, _v_equation);
+  #include "enums/clip_plane.inc"
+
+  glClipPlane(clip_plane[Int_val(_v_plane)],
+              Caml_ba_data_val(_v_equation));
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glClipPlanei(value _v_plane, value _v_equation) {
+  CAMLparam2(_v_plane, _v_equation);
+
+  glClipPlane(GL_CLIP_PLANE0 + Int_val(_v_plane),
+              Caml_ba_data_val(_v_equation));
+  CAMLreturn(Val_unit);
+}
+
+t_prim camlidl_gl_auto_glGetClipPlane(value _v_plane, value data) {
+  CAMLparam2(_v_plane, data);
+  #include "enums/clip_plane.inc"
+
+  glGetClipPlane(clip_plane[Int_val(_v_Caml)],
+                 plane_ba_data_val(data));
+  CAMLreturn(Val_unit);
+}
+
 /* Function implementations */

 t_prim gl_api_glCallLists(value n, value list_type, value lists) {