lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


varol kaptan wrote:
hi all,

I have written a binding to OpenGL and GLUT for lua 5.0.2. It is
hand-coded (no binding generators like tolua used). A considerable
portion of the OpenGL and almost all of GLUT is implemented. I would
appreciate feedback from interested parties - download the beta from
http://lua-users.org/files/wiki_insecure/users/VarolKaptan/

I downloaded the code, and it works on Mac OS X - with some changes:

1) The dynamic libraries are called .dylib (added that to makefile,
   along with the special flag -dynamiclib instead of -shared)

2) The OpenGL and GLUT headers are hidden inside frameworks here,
   so they are included as <OpenGL/gl.h> and <GLUT/gl.h> instead

3) Likewise, the libraries to link to are also inside frameworks:
   -framework OpenGL and -framework GLUT (also needs Objective-C)

4) I had compiled my lua against "dlcompat" to get the DL stuff
   (included in OS X 10.4, but this was on OS X 10.3) but it
   still needed a little Lua "loader" to find the dynamic lib...

5) You are calling glXXX functions before you have a window open.
   On Mac OS X, all such calls before there is a valid context
   will crash the application (even a simple "glPixelStoref")

Will all those changes, it spun the teapot around just fine :-)

Here is a diff of all of it: (included the Lua loaders)
http://www.algonet.se/~afb/lua/luaglut-0.1-macosx.patch

Nice work,
--anders