1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
|
LablGL 0.96-beta: Installation and Use instructions
1. Description
LablGL is an OpenGL interface for Objective Caml. Since it includes
support for the Togl widget, you can comfortably use it with LablTk.
2. Requisites
* Objective Caml 3.03-alpha
* LablTk (included in Objective Caml, requires Tcl/Tk)
* OpenGL version 1.0 or 1.1
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.
If you are not lucky enough to have 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
3. Installation
a) Edit Makefile.config
b) Build LablGL
% make
c) For the native code version (you need the native code version of LablTk),
% make opt
d) Install LablGL
% make install
4. Use
* The lablgl toplevel
This is a toplevel, like ocaml, including LablTk, Unix, Str and LablGL.
You may use it either as a toplevel, or directly to run scripts.
To run an example, type:
% lablgl -labels 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
* compiling and linking
You need to include labltk.cma, lablgl.cma and togl.cmo in your link:
ocamlc -I CAMLLIB/labltk -I CAMLLIB/lablGL \
labltk.cma lablgl.cma togl.cmo ... -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
straitforward: there is a LablGL function for each OpenGL one. For
ease of retrieving, bot 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 name is
taken from the man page or the C prototype.
OpenGL makes heavy using of enumerations, with names staring 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 LablBrowser.
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 for details.
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.
A. Modules
There are 11 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
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
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
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
glMatrixMode -> mode
glMultMatrix -> mult
glOrtho
glPopMatrix -> pop
glPushMatrix -> push
glRotate
glScale
glTranslate
GlMisc: Miscellanous functions.
glClipPlane
glGetString
glHint
glInitNames
glLoadName
glPassThrough
glPopAttrib
glPopName
glPushAttrib
glPushName
glRenderMode
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
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.
gluBeginPolygon -> begins
gluEndPolygon -> ends
gluNewTess -> create
gluTessBeginContour -> begin_contour (1.2)
gluTessBeginPolygon -> begin_polygon (1.2)
gluTessEndContour -> end_contour (1.2)
gluTessEndPolygon -> end_polygon (1.2)
gluTessNormal -> normal (1.2)
gluTessProperty -> property (1.2)
gluTessVertex -> vertex
(1.2) only available with GLU 1.2
$Id: README,v 1.13 2001/10/12 14:19:58 garrigue Exp $
|