Problem with Devil

Started by andretti, March 15, 2005, 09:01:14

Previous topic - Next topic

andretti

Hi, i've got some problems with devil. Everything has gone well till i tried Lesson06! Then i got "UnsatisfiedLinkError: no devil in java.library.path". The exception came out on IL.create() of Lesson06. I tried to set all the classpath, all the -Djava.library.path=every_path. But nothing. So i copied all the dlls in all the jdk dirs...but always the same problem!!! I read of somebody who has two dll that i don't have:ILu and ILUT. All the dlls i found in the version 0.95 were the 4 whose name start with lwjgl. I don't know what to do!!! Can somebody help me? Thanks!

Matzon

you need to place the ilu and ilut in the current dir - and the devil.dll/lwjgl_devil.dll wherever you -Djava.library.path is.
The reason is that ilu/t is loaded differently and this is causing some issues - am looking into it

andretti

Ok, i'll try...when i'll understand what are ILU and ILUt! I don't know where i can find them! In the distribuiton 0.95 i found only the 4 lwjgl dlls. Where are the ILU and ILUT dlls? Thanks!

Matzon

you need to download devil, ilu, ilut from openil.sf.net - they are not distributed with lwjgl.

andretti

Ok thank you very much! I got the dlls and now everything goes well! Only a question: i've can't find in the docs any indication about the need of getting these dlls. So maybe you should put a note about it. Or maybe i was too distract and didn't read it!! Thank you much for your valuable help!

Matzon

yeah, you're right. I'll add a note in the readme

jam007

I got a irritating problem. IÃ,´m using  DevIL and the VM crashes when I try to use a gif file.
This is the error code I get:
Quote
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x69135f2c, pid=1756, tid=508
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode, sharing)
# Problematic frame:
# C  [atioglxx.dll+0x135f2c]
#

---------------  T H R E A D  ---------------

Current thread (0x00035ea0):  JavaThread "main" [_thread_in_native, id=508]

siginfo: ExceptionCode=0xc0000005, reading address 0x02e25000

Registers:
EAX=0x0df0eaaa, EBX=0x69135f00, ECX=0x02e25000, EDX=0x0007f4ff
ESP=0x0007f410, EBP=0x00000146, ESI=0x0000005e, EDI=0x030a9040
EIP=0x69135f2c, EFLAGS=0x00010202

Top of Stack: (sp=0x0007f410)
0x0007f410:   69135f00 0007f4a8 691396e6 02e24e18
0x0007f420:   0df0e820 0007f4a8 030a9040 69139850
0x0007f430:   00000201 6913cde2 030a9040 00000100
0x0007f440:   00001907 00000200 00000002 00000002
0x0007f450:   00000005 00000001 00000000 00000000
0x0007f460:   693bf90d 00000001 690edab4 031e3480
0x0007f470:   00000000 030a9040 000083f0 00000000
0x0007f480:   031e3480 00000002 030a9040 031e3480

Instructions: (pc=0x69135f2c)
0x69135f1c:   8d 64 24 00 8a 59 fe 88 58 fe 8a 59 ff 88 58 ff
0x69135f2c:   8a 19 88 18 88 50 01 83 c1 03 83 c0 04 4e 75 e4


Stack: [0x00040000,0x00080000),  sp=0x0007f410,  free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [atioglxx.dll+0x135f2c]

[error occurred during error reporting, step 120, id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.GL11.nglTexImage2D(IIIIIIIILjava/nio/Buffer;I)V+0
j  org.lwjgl.opengl.GL11.glTexImage2D(IIIIIIIILjava/nio/ByteBuffer;)V+53
j  iceboatgame.Textures.makeTextureFromFile(Ljava/lang/String;)I+156
j  iceboatgame.Textures.requestTexture(Ljava/lang/String;)I+13
j  iceboatgame.IceBoat.<init>(Liceboatgame/IceBoatType;Ljava/awt/Color;Ljava/lang/String;DD)V+215
j  iceboatgame.Game.init()V+152
j  iceboatgame.Game.execute()V+1
j  iceboatgame.Game.main([Ljava/lang/String;)V+115
v  ~StubRoutines::call_stub
.....

My brother gets the same error so itÃ,´s not particular to my computer.
As I mentioned in an earlier post .png and .tif gives strange result while .jpg is fine

Does anyone know something about this?

Anders[/code]

Matzon

png's work fine for me, so do gifs...

this method I use is part of something bigger - so just ignore references to image, scrath and resource
public static Image loadTexture(String name, Resources resources) {
    int ilImageHandle;
    int oglImageHandle;
    Image image = null;

    // create image in Devil
    Util.scratchInt.position(0).limit(1);
    IL.ilGenImages(1, Util.scratchInt);
    IL.ilBindImage(Util.scratchInt.get(0));
    ilImageHandle = Util.scratchInt.get(0);

    // get image from resources
    ByteBuffer image_buffer = (ByteBuffer) resources.getImageResource(name);
    
    // load into Devil and get data back, we dont flip images since glOrtho handles that case
    IL.ilLoadL(IL.IL_PNG, image_buffer, image_buffer.capacity()); // *** ATTENTION *** change to IL_GIF to load gifs
    IL.ilConvertImage(IL.IL_RGBA, IL.IL_BYTE);
    image_buffer = IL.ilGetData();
    
    Util.debug("Loading resource: " + 
               name + "[" + 
               IL.ilGetInteger(IL.IL_IMAGE_WIDTH) + ", " +
               IL.ilGetInteger(IL.IL_IMAGE_HEIGHT) + ", " +
               IL.ilGetInteger(IL.IL_IMAGE_BYTES_PER_PIXEL) + "]");
    
    // get attribs
    int width = IL.ilGetInteger(IL.IL_IMAGE_WIDTH);
    int height = IL.ilGetInteger(IL.IL_IMAGE_HEIGHT);
    int textureWidthSize = getNextPowerOfTwo(width);
    int textureHeightSize = getNextPowerOfTwo(height);
    
    // check for resize image to power of two
    if(textureWidthSize != width || textureHeightSize != height) {
      image_buffer = BufferUtils.createByteBuffer(textureWidthSize * textureHeightSize * 4);
      IL.ilCopyPixels(0, 0, 0, textureWidthSize, textureHeightSize, 1, IL.IL_RGBA, IL.IL_BYTE, image_buffer);
    }
    
    // create OpenGL counterpart
    GL11.glGenTextures(Util.scratchInt);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, Util.scratchInt.get(0));
    oglImageHandle = Util.scratchInt.get(0);
    
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, textureWidthSize, textureHeightSize, 
                      0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, image_buffer);
    
    // create Image
    if(textureWidthSize != width || textureHeightSize != height) {
    	image = new Image(oglImageHandle, width, height, 
                        (width/(float)textureWidthSize), (height/(float)textureHeightSize), 
                        textureWidthSize, textureHeightSize);
    } else {
      image = new Image(oglImageHandle, width, height);
    }

    // we're done - nuke image
    Util.scratchInt.put(0, ilImageHandle);
    IL.ilDeleteImages(1, Util.scratchInt);

    // return OpenGL texture handle
    return image;
  }

jam007

Ah, I tried to use IL.ilLoadImage and read in DevIL doc that it should take care of the format.

Thanks again for helping!

Anders

Correction! It was this line that was missing IL.ilLoadImage works!
IL.ilConvertImage(IL.IL_RGBA, IL.IL_BYTE);


A