DevIL and OS X

Started by tomjnsn, February 08, 2005, 08:53:08

Previous topic - Next topic

tomjnsn

If I've read through the newsgroup correctly, and looked at the code correctly, DevIL isn't currently implemented, via JNI and the related package of org.lwjgl.devil.  Is that correct?  

If so, is this a difficult task, or more of a time consuming type task?  I'd be happy to help get it running on OS X if I'm able to be of assistance.  I have experience in both languages (although I've never written any JNI code myself).  I would just need someone to get me pointed in the right direction.

Thanks,

Tom

Matzon

I think that getting devil to run, is largely a matter of creating a makefile and compiling it... The code should be compilable on the OSX and Devil works on OSX too so...

Try grabbing a copy from cvs, and copy one of the makefiles and mod it to find devils needs

gregorypierce

Its more a matter of time. The DevIL source actually builds on OSX already. Someone just needs to build a jnilib dynalib out of it.

Matzon

err - are you talking the Devil source or the lwjgl-devil source? I am aware of devil compiling on mac, we just need someone to compile the lwjgl-devil, which I assume is a matter of a build file...

tomjnsn

yeah, I was talking about the lwjgl-devil not devil itself.  I'll give it a whirl this evening and see what I can get with it.

Tom[/i]

tomjnsn

OK, I got the lwjgl-devil.jnilib to compile with the following Makefile:

CC=gcc
LINKER=gcc
STRIP=strip
CFLAGS_LINK=-dynamiclib -Wall
FRAMEWORKS=-framework Foundation -framework AppKit -framework JavaVM -framework Carbon -framework IL
CFLAGS_O=-fPIC -O2 -D_MACOSX -Wall -c -I${AL}/include -I.. -I. -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
SRC=$(wildcard *.c) ../common_tools.c
OBJECTS=$(subst .c,.o,$(SRC))
LIBRARY=liblwjgl-devil.jnilib

$(LIBRARY): $(OBJECTS)
    $(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(FRAMEWORKS)
    $(STRIP) -S -X $@

.c.o:
    $(CC) $(CFLAGS_O) $< -o $@

clean:
    rm -f $(OBJECTS) $(LIBRARY)


I had a problem on line 370 of org_lwjgl_devil_ILU.c where the method iluGetImageInfo() was being passed an extra param, so I dropped it, and no one complained  :)  

I'm trying to do the NeHe lessons, and was originally working with Lesson 6 that I wanted to get this all working.  So I copied the new liblwjgl-devil.jnilib into the eclipse project where I have my liblwjgl.jnilib.

Now at this point, things were blowing up in the anonymous static constructor for the org.lwjgl.devil.IL class on the first System.loadLibrary() call for the "DevIL" library.  I commented this line out and things seemed to run, but nothing is appearing in the example.

I'm not sure that I compiled things correctly, and I may very well have blown something up by commenting out one of the items above, or altering that one line.  I tried using a jpeg image instead of the bmp that is supplied for testing, and the whole thing blows up on the Display.update() at line 68 with the following stack trace:

org.lwjgl.opengl.OpenGLException: Invalid value (1281)
   at org.lwjgl.opengl.Util.checkGLError(Util.java:56)
   at org.lwjgl.opengl.Display.update(Display.java:485)
   at Lesson06.run(Lesson06.java:68 )
   at Lesson06.main(Lesson06.java:59)

Any suggestions?

Thanks,

Tom

tomjnsn

I guess another thing I forgot to ask is does anyone have even some rough estimates in the speed improvement utilizing devil as opposed to going through java?  I'm wondering also if I'm going to have to distribute the whole framework of devil for os x or if I could just have a dynamic library?

Thanks,

Tom

tomjnsn

Has anyone successfully gotten DevIL working with LWJGL on OS X?  Everything looked fine when I built it, but obviously I'm missing something in the process.  If I did something wrong in the Makefile (posted above) I'd be happy to be corrected so I can get this working on OS X.