Hello Guest

Funny thing, I have most LWJGL projects working except this

  • 18 Replies
  • 13791 Views
java.lang.UnsatisfiedLinkError: nglGenTextures
      at org.lwjgl.opengl.GL11.nglGenTextures(Native Method)
      at org.lwjgl.opengl.GL11.glGenTextures(Unknown Source)
      at src.main.Video.loadTexture(Video.java:176)
      at src.main.Video.init(Video.java:45)
      at src.main.Main.<init>(Main.java:29)
      at src.main.Main.main(Main.java:35)
Exception in thread "main" Finished executing

 :roll:

You see, all my other LWJGL project work fine.
I can knock up a shaded poly in seconds.

Unfortunately this project has a link error. I have followed all the instructions on the LWJGL site and even read the FAQ doing what it asks. In the end, it did nothing.

http://members.optusnet.com.au/ksaho/dlds/src.zip

I've spent hours trying to repair this problem with no luck.
I'm on the brink of insanity, can someone please help me?

Thanks

*

Offline Optus

  • *
  • 24
    • http://www.3r337.org
Funny thing, I have most LWJGL projects working except this
« Reply #1 on: April 16, 2004, 15:19:14 »
Well the UnsatisfiedLinkError is thrown when the JNI Java code cannot find the corresponding method in the native library.  What I would check is that 1) You have the project currently set up with the lwjgl.dll and lwjglaudio.dll from version 0.9. And 2) that there aren't multiple binaries fom different versions of LWJGL also in your path.

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Funny thing, I have most LWJGL projects working except this
« Reply #2 on: April 16, 2004, 15:38:24 »
Did you succesfully create the WIndow? In 0.9, the GL functions are not bound to the java stubs before a valid context is current.
 
 - elias

Funny thing, I have most LWJGL projects working except this
« Reply #3 on: April 17, 2004, 02:51:51 »
Yes, the Window is successfully created and so is the actual square which I made if you comment out the image loader.

Optus, I have done the things you mentioned.
No luck.

Funny thing, I have most LWJGL projects working except this
« Reply #4 on: April 17, 2004, 08:40:53 »
Here is the problem:

/**buff = IntBuffer.wrap(getIntContents());****/ -works nicely

GL11.glGenTextures(buff); -CHA CHING

Why isn't this working?

*BTW I've done a lot of testing.

Funny thing, I have most LWJGL projects working except this
« Reply #5 on: April 17, 2004, 09:06:15 »
Hmm, I don't know why it would cause a link error, but there's a problem there that LWJGL methods require direct buffers - I suspect IntBuffer.wrap() will not return a direct buffer.

(Edit: Yep, confirmed.  From Javadoc: "A int buffer created via the wrap methods of this class will be non-direct")

Try swapping that code out for something like:

Code: [Select]
import org.lwjgl.BufferUtils;
Code: [Select]
int[] array = getIntContents();
buff = BufferUtils.createIntBuffer(array.length);
buff.put(array).flip();
GL11.glGenTextures(buff);
ellomynameis Charlie Dobbie.

Funny thing, I have most LWJGL projects working except this
« Reply #6 on: April 17, 2004, 14:58:17 »
Thanks, but it still displays the same error. :(

Here is my new code used as a test bed to repair this error:

Code: [Select]

public class Main
{
private void programExec()
{
buff = BufferUtils.createIntBuffer(MAX);

buff.put(getIntContents()).flip();

GL11.glGenTextures(buff);
}


private int[] getIntContents()
{
int[] c = new int[MAX];
int i=0;

try
{
   c[i] = fr.read();

   while(c[i] != -1)
{
i++;
c[i] = fr.read();
}
}catch (Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
}

return c;
}

/**
* MAIN
*/
public Main()
  {
 try
{
  fr = new FileReader("c:\\texture.PNG");
} catch (Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
e.printStackTrace();
}
}

public static void main(String[] args)
  {
Main main = new Main();

main.programExec();
}
/**
* MAIN
*/

BufferedImage bufImg;
Image img;
ImageIcon imgIc;
FileReader fr;
IntBuffer buff;

final static int MAX = 25000;
}

Funny thing, I have most LWJGL projects working except this
« Reply #7 on: April 17, 2004, 15:15:49 »
New update:

Code: [Select]

//GL11.glGenTextures(buff); -cancelled this line out
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL11.GL_ALPHA8, GL11.GL_RGBA8, buff);


The problem seems to be with the buffer itself even though I have already done what it was said, I've also originally used NEHE's code and that displayed the same error.

C:\Program Files\Java\j2sdk1.5.0\bin\java.exe   -classpath "C:\Program Files\Java\j2sdk1.5.0\jre\lib\rt.jar;C:\Program Files\Java\j2sdk1.5.0\lib\tools.jar;C:\Program Files\Java\j2sdk1.5.0\lib\lwjgl.jar;C:\Documents and Settings\Kruno_K.I.L.E.R\My Documents\java\test\classes" Main
java.lang.UnsatisfiedLinkError: nglGetTexImage
      at org.lwjgl.opengl.GL11.nglGetTexImage(Native Method)
      at org.lwjgl.opengl.GL11.glGetTexImage(Unknown Source)
      at Main.programExec(Main.java:22)
      at Main.main(Main.java:68 )
Exception in thread "main" Finished executing

To tell you the truth I have no idea where the error is coming from now that I think about it even harder. :(

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Funny thing, I have most LWJGL projects working except this
« Reply #8 on: April 17, 2004, 15:27:18 »
So where's your Window.create?

 - elias

Funny thing, I have most LWJGL projects working except this
« Reply #9 on: April 17, 2004, 15:35:23 »
Don't need it.

It's only a test class to solve the specific problem.

The problem occurs on NEHE's original code, my code as well as this test code code which leaves me baffled.

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Funny thing, I have most LWJGL projects working except this
« Reply #10 on: April 17, 2004, 15:44:45 »
But without a valid and current context (the Window) there're will be no GL functions to call... If you just created any window (640*480 with 0 in all caps values, you should be all right)

 - elias

Funny thing, I have most LWJGL projects working except this
« Reply #11 on: April 17, 2004, 15:55:10 »
Officially, it's working.

Problem?

DLL in wrong place.

My suggestion:

Update the installation instructions with this information:
Place the DLLs in the JDK's bin directory.

Thanks guys, I can't believe how stupid I am, I should have seen this coming.

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Funny thing, I have most LWJGL projects working except this
« Reply #12 on: April 17, 2004, 16:04:29 »
No, you should never place the dll anywhere 'system' like, as that will most certainly lead to versioning problems some day (even though I did implement a version check for 0.9... It seems that it didn't kick in in this case though). Always place the dll/so/jnilib in the same directory as the lwjgl.jar file and preferably in the game's local directory, not a system dir like the jdk dir.

 - elias

Funny thing, I have most LWJGL projects working except this
« Reply #13 on: April 17, 2004, 16:10:00 »
Since it's working and I know where the DLLs are would it be okay?

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Funny thing, I have most LWJGL projects working except this
« Reply #14 on: April 17, 2004, 16:36:36 »
Hehe, sure, I didn't mean to lecture you, it was more a statement of intent that the libs never were meant to be installed in a system location because they change so often and are are very tied to the jar

 - elias