Module FunGL


module FunGL: sig .. end
An experimental attempt at a functional interface to OpenGL.


This module trys to be a functional wrapper around OpenGL, so you don't have to think about the side effects and restoring the previous gl state when using these functions. You can set parameters for a local effect.
type vertex2 = float * float 
(x,y)
type vertex3 = float * float * float 
(x,y,z)
type vertex4 = float * float * float * float 
(x,y,z,w)
type vector = float * float * float 
type rgb = float * float * float 
type rgba = float * float * float * float 
type uv = float * float 
type matrix4x4 = float array 

type qualified_vertices =
| Vertices2 of vertex2 list
| Vertices3 of vertex3 list
| Vertices4 of vertex4 list
| Normal_Vertices2 of (vector * vertex2) list
| Normal_Vertices3 of (vector * vertex3) list
| Normal_Vertices4 of (vector * vertex4) list
| RGB_Vertices2 of (rgb * vertex2) list
| RGB_Vertices3 of (rgb * vertex3) list
| RGB_Vertices4 of (rgb * vertex4) list
| RGBA_Vertices2 of (rgba * vertex2) list
| RGBA_Vertices3 of (rgba * vertex3) list
| RGBA_Vertices4 of (rgba * vertex4) list
| Normal_RGB_Vertices2 of (vector * rgb * vertex2) list
| Normal_RGB_Vertices3 of (vector * rgb * vertex3) list
| Normal_RGB_Vertices4 of (vector * rgb * vertex4) list
| Normal_RGBA_Vertices2 of (vector * rgba * vertex2) list
| Normal_RGBA_Vertices3 of (vector * rgba * vertex3) list
| Normal_RGBA_Vertices4 of (vector * rgba * vertex4) list
| UV_Vertices2 of (uv * vertex2) list
| UV_Vertices3 of (uv * vertex3) list
| UV_Vertices4 of (uv * vertex4) list
| UV_Normal_Vertices2 of (uv * vector * vertex2) list
| UV_Normal_Vertices3 of (uv * vector * vertex3) list
| UV_Normal_Vertices4 of (uv * vector * vertex4) list
| UV_RGB_Vertices2 of (uv * rgb * vertex2) list
| UV_RGB_Vertices3 of (uv * rgb * vertex3) list
| UV_RGB_Vertices4 of (uv * rgb * vertex4) list
| UV_RGBA_Vertices2 of (uv * rgba * vertex2) list
| UV_RGBA_Vertices3 of (uv * rgba * vertex3) list
| UV_RGBA_Vertices4 of (uv * rgba * vertex4) list
| UV_Normal_RGB_Vertices2 of (uv * vector * rgb * vertex2) list
| UV_Normal_RGB_Vertices3 of (uv * vector * rgb * vertex3) list
| UV_Normal_RGB_Vertices4 of (uv * vector * rgb * vertex4) list
| UV_Normal_RGBA_Vertices2 of (uv * vector * rgba * vertex2) list
| UV_Normal_RGBA_Vertices3 of (uv * vector * rgba * vertex3) list
| UV_Normal_RGBA_Vertices4 of (uv * vector * rgba * vertex4) list
val render_primitive : GL.primitive -> qualified_vertices -> unit
render the given list of qualified vertices as the required primitive
val draw_translated : vector -> (unit -> unit) -> unit
use this function as replacement of GL.glTranslate
val draw_rotated : float -> vector -> (unit -> unit) -> unit
use this function as replacement of GL.glRotate
val draw_scaled : vector -> (unit -> unit) -> unit
use this function as replacement of GL.glScale
val draw_as_identity : (unit -> unit) -> unit
use this function as replacement of GL.glLoadIdentity
val draw_with_matrix : matrix4x4 -> (unit -> unit) -> unit
use this function as replacement of GL.glMultMatrix/Flat
val draw_with_rgb : rgb -> (unit -> unit) -> unit
use this function as replacement of GL.glColor3
val draw_with_rgba : rgba -> (unit -> unit) -> unit
use this function as replacement of GL.glColor4
val draw_with_material : face:GL.face_mode -> mode:GL.Material.material_mode -> (unit -> unit) -> unit
use this function as replacement of GL.glMaterial
val draw_with_lightModel : light_model:GL.light_model -> (unit -> unit) -> unit
use this function as replacement of GL.glLightModel
val draw_with_shadeModel : shade_mode:GL.shade_mode -> (unit -> unit) -> unit
use this function as replacement of GL.glShadeModel
val draw_with_frontFace : orientation:GL.orientation -> (unit -> unit) -> unit
use this function as replacement of GL.glFrontFace
val draw_enabled : cap:GL.gl_capability -> (unit -> unit) -> unit
use this function as replacement of GL.glEnable
val draw_disabled : cap:GL.gl_capability -> (unit -> unit) -> unit
use this function as replacement of GL.glDisable
val draw_with_viewport : viewport:int * int * int * int -> (unit -> unit) -> unit
use this function instead of GL.glViewport when you use a local viewport
val draw_with_polygonMode : face:GL.face_mode -> mode:GL.polygon_mode -> (unit -> unit) -> unit
use this function as replacement of GL.glPolygonMode
val do_with_matrixMode : mode:GL.matrix_mode -> (unit -> unit) -> unit
use this function as replacement of GL.glMatrixMode
val draw_with_lineWidth : width:float -> (unit -> unit) -> unit
use this function as replacement of GL.glLineWidth
val draw_with_pointSize : size:float -> (unit -> unit) -> unit
use this function as replacement of GL.glPointSize