module FunGL: sig
.. end
An experimental attempt at a functional interface to OpenGL.
This module tries 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.
Types
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
Replacement Functions
val draw_translated : vector -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glTranslate
(
glTranslate
is now deprecated)
val draw_rotated : float -> vector -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glRotate
(
glRotate
is now deprecated)
val draw_scaled : vector -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glScale
(
glScale
is now deprecated)
val draw_as_identity : (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glLoadIdentity
(
glLoadIdentity
is now deprecated)
val draw_with_matrix : matrix4x4 -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glMultMatrix
/Flat
(
glMultMatrix/Flat
is now deprecated)
val draw_with_rgb : rgb -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glColor3
(
glColor3
is now deprecated)
val draw_with_rgba : rgba -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glColor4
(
glColor4
is now deprecated)
val draw_with_material : face:GL.face_mode -> mode:GL.Material.material_mode -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glMaterial
(
glMaterial
is now deprecated)
val draw_with_lightModel : light_model:GL.light_model -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glLightModel
(
glLightModel
is now deprecated)
val draw_with_shadeModel : shade_mode:GL.shade_mode -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glShadeModel
(
glShadeModel
is now deprecated)
val draw_with_frontFace : orientation:GL.orientation -> (unit -> unit) -> unit
val draw_with_cullFace : mode:GL.face_mode -> (unit -> unit) -> unit
val draw_enabled : cap:GL.gl_capability -> (unit -> unit) -> unit
val with_enablements : caps:GL.gl_capability list -> (unit -> unit) -> unit
same than draw_enabled
but with several capabilities
val draw_disabled : cap:GL.gl_capability -> (unit -> unit) -> unit
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
val draw_with_polygonMode2 : front:GL.polygon_mode -> back:GL.polygon_mode -> (unit -> unit) -> unit
val do_with_matrixMode : mode:GL.matrix_mode -> (unit -> unit) -> unit
Deprecated.functional replacement for
GL.glMatrixMode
(
glMatrixMode
is now deprecated)
val draw_with_lineWidth : width:float -> (unit -> unit) -> unit
use this function as replacement of
GL.glLineWidth
,
in OpenGL >= 3.0, this function does not support values greater than 1.0 anymore.
val draw_with_pointSize : size:float -> (unit -> unit) -> unit
val draw_using_program : program:GL.shader_program -> (unit -> unit) -> unit
Drawing
type
qualified_vertices =
val render_primitive : GL.primitive -> qualified_vertices -> unit
Deprecated.render the given list of qualified vertices as the required primitive.
This function uses the immediate mode which is deprecated, so use
Ogl_draw.make_mesh
and Ogl_draw.draw_mesh
instead.