So ive decided to start using LWJGL to test some stuff out. I have never used an api before and I do not know how to install it. could someone please run over how to install it, I already have the build noted in the engines section downloaded or is there another build I should use?
Hi,
I’d recommend starting here: http://lwjgl.com/wiki/index.php?title=Main_Page#Getting_started
Mike
Its very easy.
- Go to this page:
http://www.lwjgl.org/download.php
And download LWJGL (the one with the most downloads) - Extract the zip into a folder you will remember
3.Open Eclipse (if you aren’t using Eclipse then stop reading because I don’t know how to do this with any other IDE.) - Create your project.
- Right click on project and select properties (or ALT+Enter)
- Click Java Build Path on the left
- Click Add External Jars
- Navigate to the LWJGL folder you created and add these jars from /jars:
lwjgl_util.jar
lwjgl.jar
These are the two basics ones you will almost always need
8. Click the little arrow next to the lwjgl.jar and click Native library location
9. Navigate back to the LWJGL folder and go to native/your_os and hit ok
And you’re done!
Thanks this really helped.
If you’re talking to me, no problem
hmm I tried using SHC’s first tutorial with a basic game but I get the error
usage:
XPMFile
java.lang.ArrayIndexOutOfBoundsException: 0
at org.lwjgl.util.XPMFile.main(XPMFile.java:260)
I’ve never seen that before, and it doesn’t look like its related to LWJGL. Are you sure you set up everything correctly? Try just creating a new file with only a main method in it and print something out. Then run it. Just to make sure you set up everything correctly.
I think you get that error when you haven’t set up the natives.
Go to eclipse, right-click project, properties, java build path, libraries, expand lwjgl.jar and lwjgl_utils.jar, click native library location, edit, and then set that to the location of the natives folder.
C:\eclipse\LWJGL\lwjgl-master\src\native is where I have set it
You need to set it to that directory but select your is also. So …/natives/windows if you’re running on Windows. Simply selecting the natives folder won’t work.
C:\eclipse\LWJGL\lwjgl-master\src\native\windows same error.
Im accessing the jars at C:\eclipse\LWJGL\lwjgl-master\eclipse-update\org.lwjgl
fixed that now im getting Exception in thread “main” java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:82)
at org.lwjgl.Sys.(Sys.java:99)
at org.lwjgl.opengl.Display.(Display.java:130)
at gametest.Game.(Game.java:28)
at gametest.Game.main(Game.java:21)
You need to add natives to your LWJGL library. You either need to add them manually, or specify the folder they are located in for you lwjgl.jar file.
I don’t know why you are accessing them through here:
C:\eclipse\LWJGL\lwjgl-master\src\native\windows same error.
But that doesn’t sound correct at all. Did you follow my steps? I told you to download LWJGL and extract it. No where in the zip I told you to download is the folder src. Don’t download the src LWJGL, just download the standard LWJGL.