Trouble with DevIL

Started by Jimmy_Scythe, June 04, 2005, 17:07:24

Previous topic - Next topic

Jimmy_Scythe

I ripped the texture loader right out of the sample code on the main site because I thought it would be less of a pain than writing my own AWT or Java2D texture loader. everyting compiled just fine and I copied the /jar and /native directories to the projects base directory and then tried to launch it with "java -cp ;res;jar/lwjgl.jar;jar/lwjgl_devil.jar; -Djava.library.path=native " and I got this error message:

Exception in thread "main" java.lan.NoSuchMethodError: org.lwjgl.devil.IL.ilGenImages(ILjava/nio/IntBuffer;)V


 Is this method just not implemented yet or is there a bug in the sample code that I'm not aware of due to my complete and total ignorance of DevIL?

The code I used can be found here: http://java-game-lib.sourceforge.net/wiki/tiki-index.php?page=Developers+Image+Library

Matzon

Are you sure you're calling create ?
does the org.lwjgl.test.devil.BasicTest work ?

Jimmy_Scythe

yeah, I called create in the app's init method. I'm not sure if devil.BasicTest worked since it just gave me alot of text that I couldn't really understand other than "error=noerror" and the names of different methods used by DevIL. ilGenImages was the very first thing that came out of BasicTest, so I'm totally baffled as to why it can't find the method at runtime. I think I'm just gonna throw all the *.jar files into the command line and see if the VMt can't find it then.

Matzon

you need to make sure that the devil libs are locatable too via the  -Djava.library.path

Jimmy_Scythe

Okay..... I'm starting to think that something is wrong somewhere else in my code. the -Djava.library.path=native and the native folder contains DevIL.dll, ILU.dll, ILUT.dll and lwjgl-devil.dll. It could be something with java.nio. * but I don't think that's likely. BTW I ran basic test from the project folder and it returned "noerror" on both ilGenImages and ilBindImage. since there was no resource file in that directory (I use \Data for the 3D information and textures) it couldn't run all the tests. This means that I should probably go back over the code and rebuild since everything else can find the ilGenImages method and my app can't. I think NeHe did a 3D walkthrough project like this but Im not sure if it's been converted yet. If it has been I'll try it and then see what he did differently if it works.

Jimmy_Scythe

I found the NeHe code that was similar to what I was doing. I'm using anim8or files but the concept is still basically the same as NeHe's Lesson10. Problem is that the exact same code is used in the LWJGL implementation of that lesson and the code doesn't work. I'm kinda wondering if the method is declared wrong and the VM is looking for an overload of the ilGenImages() method. the full error reads:

Exception in thread "main" java.lang.NoSuchMethodError:  org.lwjgl.devil.IL.ilGenImages(ILjava/nio/intBuffer;)V

   The javadoc entry for ilGenimages() states that it's "public static void ilGenImages(java.nio.IntBuffer images)". So I'm thinking the problem is either in the line that reads:

IntBuffer image= ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer()
;

  or in the declaration of ilGenImages() itself which reads:

IL.ilGenImages(1, image);

  I'm thinking that the 1 is un-needed. <shrugs> I'm gonna try omitting the 1 from the declaration. Aside from that, I'm tapped for ideas. Any other thoughts on this would be helpful to anyone trying to use this code snippet in their own stuff.

Matzon

QuoteI'm thinking that the 1 is un-needed. <shrugs> I'm gonna try omitting the 1 from the declaration. Aside from that, I'm tapped for ideas. Any other thoughts on this would be helpful to anyone trying to use this code snippet in their own stuff.
the 1 IS irrelevant, since it's read from the passed buffers .remaining() method.

However, you really should be able to compile at all if you pass a 1, since it shouldn't be able to locate that method??

Jimmy_Scythe

I can't figure out why it compiled either. After I ditched the 1 everything ran fine. Interestingly enough, the LWJGL implementation of NeHe's Lesson10 unzipped with a Lesson10 class already compiled. It got the same error. I'm sure that ilGenImages(1,image) was written in the sample code because that's how the function is called in C/C++ but you'd think that whoever set that up would have tested it before posting it. I can't speak for the creator of the Lesson10 code but I'm going over my own program to try and figure out why it compiled at all.

Matzon

think the problem is that the old devil code used c style arguments, but that was changed 2 releases ago.