Module GL


module GL: sig .. end
OpenGL functions


OpenGL Specifications

Drawing Functions



type primitive =
| GL_POINTS
| GL_LINES
| GL_LINE_LOOP
| GL_LINE_STRIP
| GL_TRIANGLES
| GL_TRIANGLE_STRIP
| GL_TRIANGLE_FAN
| GL_QUADS
| GL_QUAD_STRIP
| GL_POLYGON
val glBegin : primitive:primitive -> unit
doc on opengl.org
val glEnd : unit -> unit
val glVertex2 : x:float -> y:float -> unit
val glVertex3 : x:float -> y:float -> z:float -> unit
val glVertex4 : x:float -> y:float -> z:float -> w:float -> unit
doc on opengl.org
val glVertex2v : v:float * float -> unit
val glVertex3v : v:float * float * float -> unit
val glVertex4v : v:float * float * float * float -> unit
val glNormal3 : nx:float -> ny:float -> nz:float -> unit
doc on opengl.org
val glNormal3v : v:float * float * float -> unit
val glIndex : c:float -> unit
val glIndexi : c:int -> unit
manual page
val glColor3 : r:float -> g:float -> b:float -> unit
val glColor4 : r:float -> g:float -> b:float -> a:float -> unit
doc on opengl.org
val glColor3v : v:float * float * float -> unit
val glColor4v : v:float * float * float * float -> unit
val glColor3c : r:char -> g:char -> b:char -> unit
val glColor4c : r:char -> g:char -> b:char -> a:char -> unit
not clamped to range [0.0 - 1.0] but ['\000' - '\255']
val glEdgeFlag : flag:bool -> unit
doc on opengl.org
val glRasterPos2 : x:float -> y:float -> unit
val glRasterPos3 : x:float -> y:float -> z:float -> unit
val glRasterPos4 : x:float -> y:float -> z:float -> w:float -> unit
doc on opengl.org
val glRect : x1:float -> y1:float -> x2:float -> y2:float -> unit
val glRecti : x1:int -> y1:int -> x2:int -> y2:int -> unit
doc on opengl.org
val glLineStipple : factor:int -> pattern:int -> unit
manual page

Transformations



type matrix_mode =
| GL_MODELVIEW
| GL_PROJECTION
| GL_TEXTURE
val glMatrixMode : mode:matrix_mode -> unit
doc on opengl.org
val glViewport : x:int -> y:int -> width:int -> height:int -> unit
doc on opengl.org
val glOrtho : left:float ->
right:float ->
bottom:float -> top:float -> near_val:float -> far_val:float -> unit
doc on opengl.org
val glFrustum : left:float ->
right:float -> bottom:float -> top:float -> near:float -> far:float -> unit
doc on opengl.org
val glPushMatrix : unit -> unit
val glPopMatrix : unit -> unit
doc on opengl.org
val glLoadIdentity : unit -> unit
doc on opengl.org
val glRotate : angle:float -> x:float -> y:float -> z:float -> unit
doc on opengl.org
val glTranslate : x:float -> y:float -> z:float -> unit
doc on opengl.org
val glScale : x:float -> y:float -> z:float -> unit
doc on opengl.org
val glMultMatrix : mat:float array array -> unit
checks the matrix given is 4x4 with assertions

doc on opengl.org

val glMultMatrixFlat : float array -> unit
as glMultMatrix but with an array of length 16

Lighting



type shade_mode =
| GL_FLAT
| GL_SMOOTH
val glShadeModel : shade_mode -> unit
doc on opengl.org
module Light: sig .. end

type gl_light =
| GL_LIGHT of int
val glLight : light:gl_light -> pname:Light.light_pname -> unit
manual page

type color_control =
| GL_SEPARATE_SPECULAR_COLOR
| GL_SINGLE_COLOR

type light_model =
| GL_LIGHT_MODEL_AMBIENT of (float * float * float * float)
| GL_LIGHT_MODEL_COLOR_CONTROL of color_control
| GL_LIGHT_MODEL_LOCAL_VIEWER of bool
| GL_LIGHT_MODEL_TWO_SIDE of bool
val glLightModel : light_model:light_model -> unit
manual page

See glGetLight for associated get.

type face_mode =
| GL_FRONT
| GL_BACK
| GL_FRONT_AND_BACK
module Material: sig .. end
val glMaterial : face:face_mode -> mode:Material.material_mode -> unit
manual page

type color_material_mode =
| GL_EMISSION
| GL_AMBIENT
| GL_DIFFUSE
| GL_SPECULAR
| GL_AMBIENT_AND_DIFFUSE
val glColorMaterial : face:face_mode -> mode:color_material_mode -> unit
doc on opengl.org

Stenciling



type gl_func =
| GL_NEVER
| GL_LESS
| GL_EQUAL
| GL_LEQUAL
| GL_GREATER
| GL_NOTEQUAL
| GL_GEQUAL
| GL_ALWAYS
val glStencilFunc : func:gl_func -> ref:int -> mask:int -> unit
doc on opengl.org
val glStencilFuncn : func:gl_func -> ref:int -> mask:nativeint -> unit
OCaml standard ints have 1 bit missing from nativeint.
val glStencilMask : mask:int -> unit
manual page

type stencil_op =
| GL_KEEP
| GL_ZERO
| GL_REPLACE
| GL_INCR
| GL_INCR_WRAP
| GL_DECR
| GL_DECR_WRAP
| GL_INVERT
val glStencilOp : sfail:stencil_op -> dpfail:stencil_op -> dppass:stencil_op -> unit
manual page
val glClearStencil : s:int -> unit
doc on opengl.org
val glFlush : unit -> unit
doc on opengl.org
val glFinish : unit -> unit
doc on opengl.org

type orientation =
| GL_CW
| GL_CCW
val glFrontFace : orientation:orientation -> unit
doc on opengl.org
val glClearColor : r:float -> g:float -> b:float -> a:float -> unit
doc on opengl.org
val glClearIndex : float -> unit
doc on opengl.org
val glColorMask : r:bool -> g:bool -> b:bool -> a:bool -> unit
doc on opengl.org

Depth Buffer


val glDepthRange : near_val:float -> far_val:float -> unit
doc on opengl.org
val glClearDepth : depth:float -> unit
doc on opengl.org
val glDepthMask : bool -> unit
doc on opengl.org

Accumulation Buffer


val glClearAccum : r:float -> g:float -> b:float -> a:float -> unit
doc on opengl.org

type accum_op =
| GL_ACCUM
| GL_LOAD
| GL_ADD
| GL_MULT
| GL_RETURN
val glAccum : op:accum_op -> value:float -> unit
doc on opengl.org

type gl_capability =
| GL_ALPHA_TEST
| GL_AUTO_NORMAL
| GL_BLEND
| GL_CLIP_PLANE0
| GL_CLIP_PLANE1
| GL_CLIP_PLANE2
| GL_CLIP_PLANE3
| GL_CLIP_PLANE4
| GL_CLIP_PLANE5
| GL_COLOR_LOGIC_OP
| GL_COLOR_MATERIAL
| GL_COLOR_TABLE
| GL_CONVOLUTION_1D
| GL_CONVOLUTION_2D
| GL_CULL_FACE
| GL_DEPTH_TEST
| GL_DITHER
| GL_FOG
| GL_HISTOGRAM
| GL_INDEX_LOGIC_OP
| GL_LIGHT0
| GL_LIGHT1
| GL_LIGHT2
| GL_LIGHT3
| GL_LIGHT4
| GL_LIGHT5
| GL_LIGHT6
| GL_LIGHT7
| GL_LIGHTING
| GL_LINE_SMOOTH
| GL_LINE_STIPPLE
| GL_MAP1_COLOR_4
| GL_MAP1_INDEX
| GL_MAP1_NORMAL
| GL_MAP1_TEXTURE_COORD_1
| GL_MAP1_TEXTURE_COORD_2
| GL_MAP1_TEXTURE_COORD_3
| GL_MAP1_TEXTURE_COORD_4
| GL_MAP1_VERTEX_3
| GL_MAP1_VERTEX_4
| GL_MAP2_COLOR_4
| GL_MAP2_INDEX
| GL_MAP2_NORMAL
| GL_MAP2_TEXTURE_COORD_1
| GL_MAP2_TEXTURE_COORD_2
| GL_MAP2_TEXTURE_COORD_3
| GL_MAP2_TEXTURE_COORD_4
| GL_MAP2_VERTEX_3
| GL_MAP2_VERTEX_4
| GL_MINMAX
| GL_MULTISAMPLE
| GL_NORMALIZE
| GL_POINT_SMOOTH
| GL_POINT_SPRITE
| GL_POLYGON_OFFSET_FILL
| GL_POLYGON_OFFSET_LINE
| GL_POLYGON_OFFSET_POINT
| GL_POLYGON_SMOOTH
| GL_POLYGON_STIPPLE
| GL_POST_COLOR_MATRIX_COLOR_TABLE
| GL_POST_CONVOLUTION_COLOR_TABLE
| GL_RESCALE_NORMAL
| GL_SAMPLE_ALPHA_TO_COVERAGE
| GL_SAMPLE_ALPHA_TO_ONE
| GL_SAMPLE_COVERAGE
| GL_SEPARABLE_2D
| GL_SCISSOR_TEST
| GL_STENCIL_TEST
| GL_TEXTURE_1D
| GL_TEXTURE_2D
| GL_TEXTURE_3D
| GL_TEXTURE_CUBE_MAP
| GL_TEXTURE_GEN_Q
| GL_TEXTURE_GEN_R
| GL_TEXTURE_GEN_S
| GL_TEXTURE_GEN_T
| GL_VERTEX_PROGRAM_POINT_SIZE
| GL_VERTEX_PROGRAM_TWO_SIDE
val glEnable : cap:gl_capability -> unit
manual page
val glDisable : cap:gl_capability -> unit
module Enabled: sig .. end
val glIsEnabled : Enabled.enabled_cap -> bool
manual page

type polygon_mode =
| GL_POINT
| GL_LINE
| GL_FILL
val glPolygonMode : face:face_mode -> mode:polygon_mode -> unit
doc on opengl.org

type clear_mask =
| GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
| GL_ACCUM_BUFFER_BIT
| GL_STENCIL_BUFFER_BIT
val glClear : mask:clear_mask list -> unit
doc on opengl.org

type gl_error =
| GL_NO_ERROR
| GL_INVALID_ENUM
| GL_INVALID_VALUE
| GL_INVALID_OPERATION
| GL_STACK_OVERFLOW
| GL_STACK_UNDERFLOW
| GL_OUT_OF_MEMORY
| GL_TABLE_TOO_LARGE
val glGetError : unit -> gl_error
doc on opengl.org
val glLineWidth : width:float -> unit
doc on opengl.org
val glPointSize : size:float -> unit
doc on opengl.org

type sprite_coord_origin =
| GL_LOWER_LEFT
| GL_UPPER_LEFT

type point_parameter =
| GL_POINT_SIZE_MIN of float
| GL_POINT_SIZE_MAX of float
| GL_POINT_FADE_THRESHOLD_SIZE of float
| GL_POINT_DISTANCE_ATTENUATION of float * float * float
| GL_POINT_SPRITE_COORD_ORIGIN of sprite_coord_origin
val glPointParameter : point_parameter -> unit
manual page
val glDepthFunc : func:gl_func -> unit
doc on opengl.org
val glAlphaFunc : func:gl_func -> ref:float -> unit
doc on opengl.org

type hint_target =
| GL_FOG_HINT
| GL_LINE_SMOOTH_HINT
| GL_PERSPECTIVE_CORRECTION_HINT
| GL_POINT_SMOOTH_HINT
| GL_POLYGON_SMOOTH_HINT

type hint_mode =
| GL_FASTEST
| GL_NICEST
| GL_DONT_CARE
val glHint : target:hint_target -> mode:hint_mode -> unit
doc on opengl.org
val glCullFace : mode:face_mode -> unit
doc on opengl.org
module DrawBuffer: sig .. end
val glDrawBuffer : mode:DrawBuffer.draw_buffer_mode -> unit
doc on opengl.org
module ReadBuffer: sig .. end
val glReadBuffer : mode:ReadBuffer.read_buffer_mode -> unit
doc on opengl.org
module Sfactor: sig .. end
module Dfactor: sig .. end
val glBlendFunc : sfactor:Sfactor.blend_sfactor -> dfactor:Dfactor.blend_dfactor -> unit
function manual ; Transparency, Translucency, and Blending Chapter

type blend_mode =
| GL_FUNC_ADD
| GL_FUNC_SUBTRACT
| GL_FUNC_REVERSE_SUBTRACT
| GL_MIN
| GL_MAX
val glBlendEquation : mode:blend_mode -> unit
manual page
module Op: sig .. end
val glLogicOp : opcode:Op.op_code -> unit
doc on opengl.org
val glPolygonOffset : factor:float -> units:float -> unit
manual page

Textures


type texture_id = int 
val glGenTextures : n:int -> texture_id array

doc on opengl.org
val glGenTexture : unit -> texture_id
module BindTex: sig .. end
val glBindTexture : target:BindTex.texture_binding -> texture:texture_id -> unit
manual page
val glBindTexture2D : texture:texture_id -> unit
equivalent to glBindTexture with parameter GL_TEXTURE_2D
val glDeleteTextures : textures:texture_id array -> unit
doc on opengl.org
val glDeleteTexture : texture:texture_id -> unit
val glIsTexture : texture:texture_id -> bool
doc on opengl.org
val glPrioritizeTextures : texture:texture_id array -> priority:float array -> unit
val glPrioritizeTexture : texture:texture_id -> priority:float -> unit
doc on opengl.org
module TexEnv: sig .. end
val glTexEnv : TexEnv.texenv_target ->
TexEnv.texenv_pname -> TexEnv.texenv_param -> unit
manual page
module TexTarget: sig .. end
module InternalFormat: sig .. end

type pixel_data_format =
| GL_COLOR_INDEX
| GL_RED
| GL_GREEN
| GL_BLUE
| GL_ALPHA
| GL_RGB
| GL_RGBA
| GL_LUMINANCE
| GL_LUMINANCE_ALPHA

type pixel_data_type =
| GL_UNSIGNED_BYTE
| GL_BYTE
| GL_BITMAP
| GL_UNSIGNED_SHORT
| GL_SHORT
| GL_UNSIGNED_INT
| GL_INT
| GL_FLOAT
| GL_UNSIGNED_BYTE_3_3_2
| GL_UNSIGNED_BYTE_2_3_3_REV
| GL_UNSIGNED_SHORT_5_6_5
| GL_UNSIGNED_SHORT_5_6_5_REV
| GL_UNSIGNED_SHORT_4_4_4_4
| GL_UNSIGNED_SHORT_4_4_4_4_REV
| GL_UNSIGNED_SHORT_5_5_5_1
| GL_UNSIGNED_SHORT_1_5_5_5_REV
| GL_UNSIGNED_INT_8_8_8_8
| GL_UNSIGNED_INT_8_8_8_8_REV
| GL_UNSIGNED_INT_10_10_10_2
| GL_UNSIGNED_INT_2_10_10_10_REV
type image_data = (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Genarray.t 
val glTexImage2D : target:TexTarget.target_2d ->
level:int ->
internal_format:InternalFormat.internal_format ->
width:int ->
height:int ->
border:int ->
format_:pixel_data_format ->
type_:pixel_data_type -> pixels:image_data -> unit
doc on opengl.org
val glTexImage1D : target:TexTarget.target_1d ->
level:int ->
internal_format:InternalFormat.internal_format ->
width:int ->
border:int ->
format_:pixel_data_format ->
type_:pixel_data_type -> pixels:image_data -> unit
doc on opengl.org
val glTexImage3D : target:TexTarget.target_3d ->
level:int ->
internal_format:InternalFormat.internal_format ->
width:int ->
height:int ->
depth:int ->
border:int ->
format_:pixel_data_format ->
type_:pixel_data_type -> pixels:image_data -> unit
manual page
val glTexCoord1 : s:float -> unit
val glTexCoord2 : s:float -> t:float -> unit
val glTexCoord3 : s:float -> t:float -> r:float -> unit
val glTexCoord4 : s:float -> t:float -> r:float -> q:float -> unit
doc on opengl.org
val glTexCoord2v : v:float * float -> unit
val glTexCoord3v : v:float * float * float -> unit
val glTexCoord4v : v:float * float * float * float -> unit
module TexParam: sig .. end
val glTexParameter : target:TexParam.tex_param_target ->
pname:TexParam.tex_param_pname -> param:TexParam.tex_parameter -> unit
doc on opengl.org
module CopyTex: sig .. end
val glCopyTexImage2D : target:CopyTex.copy_tex_target ->
level:int ->
internal_format:InternalFormat.internal_format ->
x:int -> y:int -> width:int -> height:int -> border:int -> unit
manual page
val glSampleCoverage : value:float -> invert:bool -> unit
manual page

Raster functions



type pixel_packing =
| GL_PACK_SWAP_BYTES
| GL_PACK_LSB_FIRST
| GL_PACK_ROW_LENGTH
| GL_PACK_IMAGE_HEIGHT
| GL_PACK_SKIP_PIXELS
| GL_PACK_SKIP_ROWS
| GL_PACK_SKIP_IMAGES
| GL_PACK_ALIGNMENT
| GL_UNPACK_SWAP_BYTES
| GL_UNPACK_LSB_FIRST
| GL_UNPACK_ROW_LENGTH
| GL_UNPACK_IMAGE_HEIGHT
| GL_UNPACK_SKIP_PIXELS
| GL_UNPACK_SKIP_ROWS
| GL_UNPACK_SKIP_IMAGES
| GL_UNPACK_ALIGNMENT
val glPixelStorei : pixel_packing:pixel_packing -> param:int -> unit
manual page
val glPixelZoom : xfactor:float -> yfactor:float -> unit
doc on opengl.org
module Framebuffer: sig .. end
val glReadPixelsBA_unsafe : x:int ->
y:int ->
width:int ->
height:int ->
Framebuffer.pixel_buffer_format ->
Framebuffer.pixel_buffer_type -> image_data -> unit
manual page
val glReadPixelsBA : x:int ->
y:int ->
width:int ->
height:int ->
Framebuffer.pixel_buffer_format ->
Framebuffer.pixel_buffer_type -> image_data -> unit
same than glReadPixelsBA_unsafe but checks the size of the big-array

type get_string =
| GL_VENDOR
| GL_RENDERER
| GL_VERSION
| GL_SHADING_LANGUAGE_VERSION
| GL_EXTENSIONS
val glGetString : name:get_string -> string

manual page

Evaluators


module Map1: sig .. end
val glMap1 : target:Map1.map1_target ->
u1:float -> u2:float -> stride:int -> order:int -> points:float array -> unit
doc on opengl.org
module Map2: sig .. end
val glMap2 : target:Map2.map2_target ->
u1:float ->
u2:float ->
ustride:int ->
uorder:int ->
v1:float ->
v2:float ->
vstride:int -> vorder:int -> points:float array array array -> unit
doc on opengl.org
val glEvalCoord1 : u:float -> unit
val glEvalCoord2 : u:float -> v:float -> unit
doc on opengl.org
module EvalMesh1: sig .. end
module EvalMesh2: sig .. end
val glEvalMesh1 : mode:EvalMesh1.eval_mesh_1 -> i1:int -> i2:int -> unit
val glEvalMesh2 : mode:EvalMesh2.eval_mesh_2 -> i1:int -> i2:int -> j1:int -> j2:int -> unit
doc on opengl.org
val glMapGrid1 : un:int -> u1:float -> u2:float -> unit
val glMapGrid2 : un:int -> u1:float -> u2:float -> vn:int -> v1:float -> v2:float -> unit
doc on opengl.org
module Attrib: sig .. end
val glPushAttrib : attrib:Attrib.attrib_bit list -> unit
manual page
val glPopAttrib : unit -> unit

Display Lists



type list_mode =
| GL_COMPILE
| GL_COMPILE_AND_EXECUTE
val glNewList : gl_list:int -> mode:list_mode -> unit
doc on opengl.org
val glEndList : unit -> unit
val glGenLists : range:int -> int
doc on opengl.org
val glCallList : gl_list:int -> unit
doc on opengl.org
val glCallLists : gl_lists:int array -> unit
doc on opengl.org
val glDeleteLists : gl_list:int -> range:int -> unit
doc on opengl.org
val glListBase : base:int -> unit
doc on opengl.org
val glIsList : gl_list:int -> bool
doc on opengl.org
val glGetListMode : unit -> list_mode

Picking



type render_mode =
| GL_RENDER
| GL_SELECT
| GL_FEEDBACK
val glRenderMode : mode:render_mode -> int
doc on opengl.org
val glInitNames : unit -> unit
doc on opengl.org
val glLoadName : name:int -> unit
doc on opengl.org
val glPushName : name:int -> unit
doc on opengl.org
val glPopName : unit -> unit
type select_buffer 
val new_select_buffer : buffer_size:int -> select_buffer
val free_select_buffer : select_buffer:select_buffer -> unit
val select_buffer_get : select_buffer:select_buffer -> index:int -> int
val glSelectBuffer : buffer_size:int -> select_buffer:select_buffer -> unit
doc on opengl.org
val glSelectBufferBA : (nativeint, Bigarray.nativeint_elt, Bigarray.c_layout) Bigarray.Array1.t ->
unit

Fog



type fog_mode =
| GL_LINEAR
| GL_EXP
| GL_EXP2

type fog_coord_src =
| GL_FOG_COORD
| GL_FRAGMENT_DEPTH

type fog_param =
| GL_FOG_MODE of fog_mode
| GL_FOG_DENSITY of float
| GL_FOG_START of float
| GL_FOG_END of float
| GL_FOG_INDEX of float
| GL_FOG_COLOR of (float * float * float * float)
| GL_FOG_COORD_SRC of fog_coord_src
val glFog : pname:fog_param -> unit
doc on opengl.org

Gets


module Get: sig .. end

manual page
val glGetBoolean1 : Get.get_boolean_1 -> bool
val glGetBoolean4 : Get.get_boolean_4 -> bool
val glGetInteger4 : Get.get_integer_4 -> int * int * int * int
val glGetInteger1 : Get.get_integer_1 -> int
val glGetFloat4 : Get.get_float_4 -> float * float * float
val glGetFloat3 : Get.get_float_3 -> float * float * float
val glGetFloat2 : Get.get_float_2 -> float * float
val glGetFloat1 : Get.get_float_1 -> float
val glGetMatrix : Get.get_matrix -> float array array
val glGetMatrixFlat : Get.get_matrix -> float array

type tuple_params =
| P1 of float
| P3 of float * float * float
| P4 of float * float * float * float
| PCC of color_control
val glGetLight : light:gl_light -> pname:Get.get_light -> tuple_params
manual page

Multitexture



Multitexture Node, ARB multitexture wiki

type texture_i =
| GL_TEXTURE0
| GL_TEXTURE1
| GL_TEXTURE2
| GL_TEXTURE3
| GL_TEXTURE4
| GL_TEXTURE5
| GL_TEXTURE6
| GL_TEXTURE7
| GL_TEXTURE8
| GL_TEXTURE9
| GL_TEXTURE10
| GL_TEXTURE11
| GL_TEXTURE12
| GL_TEXTURE13
| GL_TEXTURE14
| GL_TEXTURE15
| GL_TEXTURE16
| GL_TEXTURE17
| GL_TEXTURE18
| GL_TEXTURE19
| GL_TEXTURE20
| GL_TEXTURE21
| GL_TEXTURE22
| GL_TEXTURE23
| GL_TEXTURE24
| GL_TEXTURE25
| GL_TEXTURE26
| GL_TEXTURE27
| GL_TEXTURE28
| GL_TEXTURE29
| GL_TEXTURE30
| GL_TEXTURE31
val glActiveTexture : texture:texture_i -> unit
manual page
val glActiveTexturei : texture:int -> unit
glActiveTexturei i is equivalent to glActiveTexture GL_TEXTUREi
val glMultiTexCoord2 : texture:texture_i -> s:float -> t:float -> unit
manual page
val glMultiTexCoord2i : texture:int -> s:float -> t:float -> unit