OCaml Forge
SCM

File Release Notes and Changelog

Release Name: 1.04

Release Notes

		LablGL 1.04: Installation and Use instructions

1. Description

  LablGL is an OpenGL interface for Objective Caml. It includes two
interfaces: the Togl widget, for comfortable use with LablTk, and
LablGlut for standalone applications not using Tcl/Tk.

2. Requisites

  * Objective Caml 3.05 to 3.11  (only 3.11 supported on windows)
  * LablTk (included in Objective Caml, requires Tcl/Tk) for Togl support
  * OpenGL
  * glut (included in Mesa) for glut support
  * GNU make (for conditionals)

  Objective Caml can be obtained from
	http://caml.inria.fr/ocaml/

  OpenGL (with hardware support) is already on your machine on SGI and
most DEC Alpha systems. It may also be the case with Solaris machines,
and if you do not have it you may obtain it from Sun.
  XFree86 supports the GLX protocol since version 4.0, with hardware
acceleration on some platforms. It is available on most recent Linux
configurations.
  If you are not lucky enough to have built-in OpenGL support, you can
still use Mesa, an openGL-compatible freeware, which works on almost
everything.
	http://www.mesa3d.org/

  LablGl also uses the Togl widget, but the code is already included
in this distribution (version 1.5). You may obtain more information
about Togl at:
	http://www.mesa3d.org/brianp/Togl.html
Note that Togl is only compatible with vanilla Tcl/Tk: specially
patched versions may not work. For instance 8.2.3+ included in old
debian distributions does not work.

  LablGlut requires glut, which is already included in recent versions
of Mesa and XFree86. For windows you need to obtain it from
	http://www.xmission.com/~nate/glut.html

3. Installation

Precompiled versions of lablGL are available for Windows, and a number
of Linux distributions. For Linux, just install the package.

Windows binary distribution:
  The file lablgl-1.04-win32.zip supports both MSVC and mingw versions
  of ocaml 3.11. For older versions of ocaml, you should get
  lablgl-1.03-win32.zip.

  a) Install the lablGL distribution.
     The simplest way is to use the command-line version of unzip, and
     unpack it on top of your Objective Caml distribution.
        C:\Program Files\Objective Caml> unzip lablgl-1.04-win32.zip
     If you unpacked it somewhere else you must copy manually the
     contents of the bin, lib\stublibs and lib\lablGL directories to
     the corresponding directories of the Objective Caml distribution.

  b) Compile the Caml parts.
     Go to the lib\lablGL directory, and execute the following command 
        C:\...\lib\lablGL\> ocaml build.ml
     It will generate the bytecode and native versions of the library.
     Note that every time you install a new version of Objective Caml
     you will need to repeat this last step.
     Look carefully at the last line of output of this script, it should
     tell you which ocaml port you are using. If the guess is wrong, you
     edit build.ml to correct this.

  c) For glut support, download glut32.dll and copy it to the bin
     directory of the OCaml distribution (or somewhere else in your
     path.)

  After this, you should be able to compile and run programs as either
  bytecode or native code.

Compilation from source (if there is no package):

  a) Create Makefile.config.
     Some tested configurations are provided.
     If none of them fits your needs, start with Makefile.config.ex.

  b) Build LablGL with both Togl(Tcl/Tk) and Glut support.
	% make

     If you need only Togl support, do
        % make togl
     If you need only Glut support, do
        % make glut
     If you need neither (use the library with lablGtk for instance)
        % make lib


  c) For the native code version (you need the native code version of LablTk),
	% make opt

     Similarly, you can also do
        % make {toglopt,glutopt,libopt}

  d) Install LablGL
	% make install

     This will install all the available parts.   

  To compile for Windows, Makefile.config.msvc and
  Makefile.config.mingw are provided. Note however that the DLL
  produced for Togl by mingw does not work with the ocaml 3.11 binary
  distribution, you must use the one   produced by MSVC, included in
  the binary distribution above.

4. Use

  Examples are in the Togl/examples and LablGlut/examples directories.

  * The lablgl toplevel
    This is a toplevel, like ocaml, including LablTk, Unix, Str, LablGL
    and Togl.
    You may use it either as a toplevel, or directly to run scripts.
    To run an example in Togl/examples, type:
        % lablgl example.ml
    where example.ml is one of: (by order of complexity)
 	simple.ml
	scene.ml
	checker.ml	
	double.ml
	planet.ml
	texturesurf.ml
	gears.ml
	morph3d.ml
	tennis.ml

   Note that some XFree86 do not seem to support single buffer
   rendering. The first 3 examples will not work in that case.

  * Similarely, there is a lablglut toplevel.
    For instance, move to the folder LablGlut/examples/lablGL and type

	% lablglut gears.ml

  * compiling and linking
    You need to include either labltk.cma, lablgl.cma and togl.cma or'
    lablgl.cma and lablglut.cma in your link:
        ocamlc -I +labltk -I +lablGL \
            labltk.cma lablgl.cma togl.cma ... -o program
        ocamlc -I +lablGL lablgl.cma lablglut.cma ... -o program

5. Writing programs

  All of the GL and GLU libraries are available. Read a good book
  about how to use these. Translating from OpenGL to LablGL is rather
  straightforward: there is a LablGL function for each OpenGL one.
  For ease of retrieving, both GL and GLU are cut in smaller modules
  of related functions.  See in appendix A which modules your function
  is in. By default it has the same name, gl or glu omited, and
  capitals replaced by underscores.  When arguments are labelled, the
  names are taken from the man page or the C prototype.

  OpenGL makes heavy use of enumerations, with names starting with
  GL_ or GLU_ . Since their meaning is often overloaded, they are all
  converted to polymorphic variants. In most cases just replace prefix
  by a backquote and convert to low case. When you have a doubt the
  best way is to have a look with OCamlBrowser.

  Using Togl is also straightforward. Everything works like in
  LablTk. You create an openGL widget with Togl.create, and then you
  apply various functions on it. See Togl's README in Togl/src/Togl/README
  for details.

  To use LablGlut you need to look at glut's documentation on your system.
  The approach is close to LablGL's.

6. Comments and bug reports

   mailto:garrigue@kurims.kyoto-u.ac.jp

   This library has been tested on a number of programs, but this is
   far from testing all of OpenGL functionality. There are bugs, but
   at least we didn't find any in our examples.

7. Authors

   Jacques Garrigue, Isaac Trotts, Erick Tryzelaar and Christophe
   Raffali participated to this release.

A. Modules

   There are 12 modules for GL and 5 modules for GLU.
   Modules marked with (*) contain LablGL specific functions.

Gl: Common data types and functions.
   glFlush
   glFinish
   glEnable
   glDisable
   glIsEnabled
   glGetError

GlArray: Array functions
   glEdgeFlagPointer    -> edge_flag
   glTexCoordPointer    -> tex_coord
   glIndexPointer       -> index
   glNormalPointer      -> normal
   glVertexPointer      -> vertex
   glEnableClientState  -> enable
   glDisableClientState -> disable
   glArrayElement       -> element
   glDrawArrays
   glDrawElements

GlClear: Clearing functions.
   glClear
   glClearAccum		-> accum
   glClearColor		-> color
   glClearDepth		-> depth
   glClearIndex		-> index
   glClearStencil	-> stencil

GlDraw: Drawing functions.
   glBegin		-> begins
   glColor
   glCullFace
   glEdgeFlag
   glEnd		-> ends
   glFrontFace
   glIndex
   glLineStipple
   glLineWidth
   glNormal
   glPointSize
   glPolygonOffset
   glPolygonMode
   glPolygonStipple
   glRect
   glShadeModel
   glVertex
   glViewport

GlFunc: Filtering functions.
   glAccum
   glAlphaFunc
   glBlendFunc
   glColorMask
   glDepthFunc
   glDepthMask
   glDrawBuffer
   glIndexMask
   glLogicOp   
   glReadBuffer   
   glStencilFunc
   glStencilMask
   glStencilOp

GlLight: Lighting functions.
   glColorMaterial
   glFog
   glLight
   glLightModel (gl 1.2 with `color_control)
   glMaterial

GlList: Call list functions. (*)
   glCallList		-> call
   glCallLists
   glDeleteLists
   glEndList		-> ends
   glGenLists
   glIsList
   glNewList		-> begins

GlMap: Map and meshes functions.
   glEvalCoord1
   glEvalCoord2
   glEvalMesh1
   glEvalMesh2
   glEvalPoint1
   glEvalPoint2
   glMap1
   glMap2
   glMapGrid1		-> grid1
   glMapGrid2		-> grid2

GlMat: Matrix functions. (*)
   glFrustum
   glLoadIdentity
   glLoadMatrix		       -> load
   glLoadTransposeMatrix -> load_transpose (gl 1.3)
   glMatrixMode	 	       -> mode
   glMultMatrix		       -> mult
   glMultTransposeMatrix -> mult_transpose (gl 1.3)
   glOrtho
   glPopMatrix	      	 -> pop
   glPushMatrix	      	 -> push
   glRotate
   glScale
   glTranslate
   glGetDoublev          -> get_matrix (only for modelview, projection, and texture)

GlMisc: Miscellanous functions.
   glClipPlane
   glGetString
   glHint
   glInitNames
   glLoadName
   glPassThrough
   glPopAttrib
   glPopName
   glPushAttrib
   glPushName
   glRenderMode
   glScissor
   glSelectBuffer

GlPix: Rasterized pixel functions. (*)
   glBitmap
   glCopyPixels		-> copy
   glDrawPixels		-> draw
   glPixelMap		-> map
   glPixelStore		-> store
   glPixelTransfer	-> transfer
   glPixelZoom		-> zoom
   glRasterPos
   glReadPixels		-> read

GlTex: Texturing functions.
   glTexCoord		-> coord
   glTexEnv		-> env
   glTexGen		-> gen
   glTexImage1D		-> image1d
   glTexImage2D		-> image2d
   glTexParameter	-> parameter (gl 1.4 with generate_mipmap)

GluMat: GLU matrix functions.
   gluLookAt
   gluOrtho2D
   gluPerspective
   gluPickMatrix
   gluProject
   gluUnProject

GluMisc: GLU miscellanous functions.
   gluBuild1DMipmaps
   gluBuild2DMipmaps
   gluGetString
   gluScaleImage

GluNurbs: Nurbs functions.
   gluBeginCurve
   gluBeginSurface
   gluBeginTrim
   gluEndCurve
   gluEndSurface
   gluEndTrim
   gluLoadSamplingMatrices
   gluNewNurbsRenderer	-> create
   gluNurbsCurve	-> curve
   gluNurbsProperty	-> property
   gluNurbsPwlCurve	-> pwl_curve
   gluNurbsSurface	-> surface

GluQuadric: Quadric functions.
   gluCylinder
   gluDisk
   gluNewQuadric	-> create
   gluPartialDisk
   gluQuadricDrawStyle	-> draw_style
   gluQuadricNormals	-> normals
   gluQuadricOrientation -> orientation
   gluQuadricTexture	-> texture
   gluSphere

GluTess: Tessalating functions.
   Only glu 1.2 API is supported.
   Either render directly or produce lists of triangles.

Change Log

LablGL 1.04:
------------
2008-12-21:
* support windows compilation for ocaml 3.11

2008-10-25:
* support Tcl/Tk 8.5
* require Raw.static in GlArray (reported by malc)
* check for GL_ARB_texture_non_power_of_two in GlTex (reported by malc)

2008-01-10:
* fix GlMap.eval_coord2 (reported by Florent Monnier)

LablGL 1.03:
---------------------
2007-04-13: [Jacques]
* add glPolygonOffset
* fix Glut.createMenu
* fix GlTex.gen_textures

2006-07-29: [Jacques]
* make LablGlut's callback window dependent
* simplify glutInit

2006-03-23: [Jacques]
* avoid all uses of stderr in stubs (caused incompatibilities)
* use mingw import libraries
* mingw build works again (but togl only works in dll mode)

LablGL 1.02:
------------
2005-10-28: [Jacques]
* fix GlMat.mult_transpose (Gregory Guyomarc'h)

2005-10-20: [Jacques]
* correct GlTex.image2d border bug (Eric Cooper)

2005-10-14: [Jacques]
* add glGetError

2004-07-20: [Jacques]
* add index_logic_op and color_logic_op

LablGL 1.01:
------------
2004-07-13: [Jacques]
* merge Jon Harrop's tesselator support

LablGL 1.00:
------------
2003-10-01: [Jacques]
* split togl, move examples to Togl/examples
* add mingw support

2003-09-29: [Jacques]
* reorganized directories and Makefiles

2003-09-25: [Christophe]
* merge ijtrotts' LablGlut

2003-09-24: [Christophe]
* add glArray support

LablGL 0.99:
------------

* add texture binding functions, contributed by Chris Hecker

* add support for Tcl/Tk8.4

* allow compiling and installing without Tk

LablGL 0.98:
------------

* add windows port

* add lablGL.spec (Ben Martin)

* add GLU_VERSION and GLU_EXTENSIONS tags

* check returned strings

LablGL 0.97:
------------

* support ocaml 3.04

LablGL 0.96:
------------

* adapt to new label mode / new variant syntax

* split library into lablgl.cma and togl.cma to support ocaml dynamic
  linking

LablGL 0.95:
------------

* corrected variant matching for Objective Caml 3.01

* add variance annotations

* some bug fixes

LablGL 0.94:
------------

* corrected syntax for Objective Caml 3.00

LablGL 0.93:
------------

* use Objective Caml 2.99 instead of Objective Label.

* a few functions changed, to comply with the new semantics
  for optional arguments.

* togl.cmo is not included in lablgl.cma, to allow easy linking
  with lablgtk.

LablGL 0.92:
------------

* allow use of newer patch levels for Tk.

* corrected bugs in the Raw module. Now, it handles correctly
  alignment constraints on doubles.

* added the Raw.sub function, which extracts a slice from an existing
  raw array.  Values are still physically shared with the original
  array.

LablGL 0.91:
------------

* switched to Togl-1.5. The previous versions had problems on Linux.

LablGL 0.9:
-----------

* first public release