I have no idea where to start, since there are no tutorials or anything. :( Or maybe this is a dead project?
It is not a dead project, since there are big changes on the svn. But it really needs a better documentation and makefile to be more usefull to a lot of people.
Fabio
Any news on this? If there's no Makefile can anybody give me a bit of a hint for compiling with gcc on OS X?
Cheers,
Scott
Hi Scott,
I do not have experience with OS X.
But if you are just extending an OpenGL application, you can simply include LuaGL.c in your project and add LuaGL headers to your include path, that should work.
If you need to use glut, you can create a dynamic library, linking LuaGL.c and LuaGlut.c (and LuaGlu.c and LuaGLAux.c, if using the SVN version). The dependencies are on Lua, OpenGL, GLU and GLUT.
I'm using the following makefile on linux, but I think it is not very portable. I'm accepting suggestion on how to build a more portable makefile…
CC = gcc
LD = ld
INC = -Iinclude -Isrc -I/usr/include/lua5.1
LIB = -lGLU -lGL -lm -llua5.1
CFLAGS = -Wall -fPIC -c $(INC)
LFLAGS = $(LIB)
LGLUT = -lglutall: luagl luaglu luaglut
luagl: LibLuaGL
luaglu: LibLuaGlu
luaglut: LibLuaGlutclean:
rm *.o *.soLuaGLAux.o: src/LuaGLAux.c
$(CC) $^ $(CFLAGS) -o $@LuaGL.o: src/LuaGL.c
$(CC) $^ $(CFLAGS) -o $@LuaGlu.o: src/LuaGlu.c
$(CC) $^ $(CFLAGS) -o $@LuaGlut.o: src/LuaGlut.c
$(CC) $^ $(CFLAGS) -o $@LibLuaGL: LuaGL.o LuaGLAux.o
$(LD) $(LFLAGS) -shared -o LuaGL.so LuaGL.o LuaGLAux.oLibLuaGlu: LuaGlu.o LuaGLAux.o
$(LD) $(LFLAGS) -shared -o LuaGlu.so LuaGlu.o LuaGLAux.oLibLuaGlut: LuaGlut.o
$(LD) $(LFLAGS) $(LGLUT) -shared -o LuaGlut.so LuaGlut.o
Hope this helped you.
Fabio
Hi, it's funny because it's been so long since I've used this. I never did see your reply :)
Thanks for the info. I did end up getting it to work.
Cheers
could you post the makefile?
i am also a os x user, but this doesn't compile via luarocks
after some googleing and errors i managed to build with my following makefile (only for osx, luarocks doesnt build LuaGL because it doesnt give the -frameworks parameters to gcc)
But i still get some memory runtime errors
CC = export MACOSX_DEPLOYMENT_TARGET=10.3;gcc
LD = export MACOSX_DEPLOYMENT_TARGET=10.3;gcc
FrameWorks = -F/System/Library/Frameworks/
INC = -I/usr/include/ -I/usr/local/include/ $(FrameWorks) -Iinclude
LIB = $(FrameWorks) -framework OpenGL -framework GLUT -L/usr/lib/ -lgmalloc -L/usr/local/lib/ -llua5.1
CFLAGS = -pedantic -fno-common -Wall -fPIC $(INC)
LFLAGS = $(LIB) -bundle -undefined dynamic_lookup -all_load
all: LibGL LibGlut
clean:
rm *.o *.so
%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
LibGL: LuaGL.o
$(LD) $(LFLAGS) -o luagl.so LuaGL.o
LibGlut: LuaGlut.o
$(LD) $(LFLAGS) -o luaglut.so LuaGlut.o
[[/code]]
In the file luagl.c says:
#include <malloc.h>
it doesnt work in mac osx (because doesnt come with it), its better to change it to:
#include <stdio.h>
that seems to be the main problem at runtime because it keeps telling me the following error:
lua(19956,0xa000ed88) malloc: *** Deallocation of a pointer not malloced: 0x84c28;
anyone has an idea?
Good to see somebody hasn't given up on this.
Now all I am waiting for is a new version getting support for OpenGL 3.0 :)