package gl-legacy

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Gl_legacySource

The gl-legacy library is a minimal set of OCaml bindings to the venerable openGL 2.1 immediate mode. In particular, it includes Display Lists, and the interesting Feedback mode.

gl-legacy can be used by itself (see the triangle or cube example), but more reasonably it should be thought of as an add-on to the more modern tgls bindings.

When mixing this library with tgls, it is convenient to use the following aliases: (for instance if you target OpenGL 3.x)

  module Gl = Gl_legacy
  module Gl3 = Tgl3.Gl

In this way you may write things such as

Gl3.bind_texture Gl3.texture_2d tex_id;
Gl.enable Gl.texture_2d;

Then, when you have the courage to update your work to remove deprecated OpenGL 1-2 functions, they will be easy to spot.

Sourcetype enum
Sourceval enum_to_int : enum -> int
Sourceval int_to_enum : int -> enum

4x4 Matrices are flattened to 1D arrays of size 16. (column major: the first 4 elements are the first column, etc.)

Sourcetype render_mode =
  1. | RENDER
  2. | SELECT
  3. | FEEDBACK
Sourcetype display_list = enum
Sourcetype display_list_mode =
  1. | COMPILE
  2. | COMPILE_AND_EXECUTE
Sourceval (lor) : enum -> enum -> enum

OpenGL functions

For documentation, see here.

In particular, that doc tells you the meaning of the arguments, and which OpenGL constants (enums) are valid parameters for each function.

If you don't find a function below, it is maybe because it still exists in OpenGL 3, and hence can be found from tgls. For instance if you want to use OpenGL 3.x you should consult:

Sourceval call_list : enum -> unit
Sourceval call_lists : enum array -> unit
Sourceval clear : enum -> unit
Sourceval clear_color : float -> float -> float -> float -> unit
Sourceval color3f : float -> float -> float -> unit
Sourceval color4f : float -> float -> float -> float -> unit
Sourceval color_material : enum -> enum -> unit
Sourceval copy_pixels : int -> int -> int -> int -> enum -> unit
Sourceval delete_lists : enum -> int -> unit
Sourceval disable : enum -> unit
Sourceval enable : enum -> unit
Sourceval end_list : unit -> unit
Sourceval finish : unit -> unit
Sourceval flush : unit -> unit
Sourceval frustum : float -> float -> float -> float -> float -> float -> unit
Sourceval gen_lists : int -> enum
Sourceval gl_begin : enum -> unit
Sourceval gl_end : unit -> unit
Sourceval light_modelf : enum -> float -> unit
Sourceval light_modelfv : enum -> float array -> unit
Sourceval lightfv : enum -> enum -> float array -> unit
Sourceval list_mode_enum : display_list_mode -> enum
Sourceval load_identity : unit -> unit
Sourceval load_matrixd : matrixd -> unit
Sourceval load_matrixf : matrixf -> unit
Sourceval materialf : enum -> enum -> float -> unit
Sourceval materialfv : enum -> enum -> float array -> unit
Sourceval matrix_mode : enum -> unit
Sourceval mult_matrixd : matrixd -> unit
Sourceval mult_matrixf : matrixf -> unit
Sourceval new_list : enum -> display_list_mode -> unit
Sourceval normal3f : float -> float -> float -> unit
Sourceval ortho : float -> float -> float -> float -> float -> float -> unit
Sourceval pop_matrix : unit -> unit
Sourceval push_matrix : unit -> unit
Sourceval render_mode : render_mode -> int
Sourceval render_mode_enum : render_mode -> enum
Sourceval rotated : float -> float -> float -> float -> unit
Sourceval rotatef : float -> float -> float -> float -> unit
Sourceval scalef : float -> float -> float -> unit
Sourceval tex_coord2d : float -> float -> unit
Sourceval tex_coord2f : float -> float -> unit
Sourceval tex_envf : enum -> enum -> float -> unit
Sourceval tex_envfv : enum -> enum -> float Ctypes_static.ptr -> unit
Sourceval tex_envi : enum -> enum -> enum -> unit
Sourceval tex_enviv : enum -> enum -> int Ctypes_static.ptr -> unit
Sourceval translatef : float -> float -> float -> unit
Sourceval vertex2d : float -> float -> unit
Sourceval vertex2f : float -> float -> unit
Sourceval vertex3f : float -> float -> float -> unit
Sourceval vertex4f : float -> float -> float -> float -> unit
Sourceval viewport : int -> int -> int -> int -> unit

OpenGL constants

Sourceval ambient : enum
Sourceval ambient_and_diffuse : enum
Sourceval back : enum
Sourceval blend : enum
Sourceval color : enum
Sourceval color_buffer_bit : enum
Sourceval color_indexes : enum
Sourceval color_material_enum : enum
Sourceval cull_face : enum
Sourceval decal : enum
Sourceval depth : enum
Sourceval depth_buffer_bit : enum
Sourceval depth_test : enum
Sourceval diffuse : enum
Sourceval emission : enum
Sourceval feedback : enum
Sourceval front : enum
Sourceval front_and_back : enum
Sourceval light0 : enum
Sourceval light_model_ambient : enum
Sourceval light_model_local_viewer : enum
Sourceval light_model_two_side : enum
Sourceval lighting : enum
Sourceval line_loop : enum
Sourceval line_smooth : enum
Sourceval line_strip : enum
Sourceval lines : enum
Sourceval modelview : enum
Sourceval modulate : enum
Sourceval normalize : enum
Sourceval point_smooth : enum
Sourceval points : enum
Sourceval polygon : enum
Sourceval polygon_smooth : enum
Sourceval position : enum
Sourceval projection : enum
Sourceval quad_strip : enum
Sourceval quads : enum
Sourceval render : enum
Sourceval replace : enum
Sourceval select : enum
Sourceval shininess : enum
Sourceval specular : enum
Sourceval stencil : enum
Sourceval stencil_buffer_bit : enum
Sourceval texture : enum
Sourceval texture_2d : enum
Sourceval texture_env : enum
Sourceval texture_env_color : enum
Sourceval texture_env_mode : enum
Sourceval triangle_fan : enum
Sourceval triangle_strip : enum
Sourceval triangles : enum
Sourceval compile : enum
Sourceval compile_and_execute : enum
Sourcemodule List_type : sig ... end

Constants for Display Lists

Sourcemodule Feedback : sig ... end

Functions and constants for Feedback mode