Author Topic: Getting jPCT to work  (Read 1907 times)

Offline Cowbox

  • int
  • **
  • Posts: 58
  • >:D
    • View Profile
    • Soharix
Getting jPCT to work
« on: December 28, 2011, 09:39:19 pm »
I've tried going through the first topics on the Wiki but as soon as I got to the Hello World one, I found problems...

First off, it doesn't actually tell me how to make any of the objects it wants, I'm just sorta guessing at where the line World world; needs to go and whether I need FrameBuffer buffer; or something else.

And as for making the object box, I have absolutely no idea what it's talking about so I had to leave that code out.

After getting some code to work (omitting the parts that concern box of course) I get the following output in the console because I can't set the screen to use width, height, colour depth, frequency and screenmode - it's only got room for width, height and sampling mode as parameters:
Code: [Select]
run:
Java version is: 1.7.0
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Loading Texture...box.jpg
Software renderer disposed
Current mode:800 x 600 x 32 @75Hz
[ Wed Dec 28 20:23:24 GMT 2011 ] - WARNING: ZBuffer depth of 24 not supported - trying something else now...!
[ Wed Dec 28 20:23:24 GMT 2011 ] - WARNING: Does this machine actually support OpenGL? Trying everything at lowest settings now!
Driver is unknown!
[ Wed Dec 28 20:23:24 GMT 2011 ] - ERROR: Unable to set any valid videomode on this machine!
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
[ Wed Dec 28 20:23:24 GMT 2011 ] - ERROR: Can't set videomode - try different settings!
New WorldProcessor created using 1 thread(s) and granularity of 1!
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.main(Rats.java:24)
Software renderer disposed
BUILD SUCCESSFUL (total time: 9 seconds)
My monitor doesn't do 75Hz as a refresh rate and I can't tell it not to use a 24bit Z buffer anywhere.

So whatever, I left that and went for the only complete code example I could find which was the Advanced example. So I stuck that code in, changed all the right thing and ran it. - It did exactly the same thing, kicking up a fuss about Zdepth, resolution and LWJGL instances.

So I gave up and went off to see if I could run the examples that actually came with the engine. (Because I already knew the examples available from the website worked fine.)

I tried running all 4 examples and each .bat just opens and closes without making another window. - Running the .bats in cmd tells me the following:
Unable to load native library: Can't load IA 32-bit .dll on a AMD 64-bit platform
And as far as I'm aware, the .dlls for LWJGL on a 64bit system are in the natives\windows folder because they're the same ones I use on my other Java games (in Slick2D).

So now I'm stumped... I've tried following the tutorials, I've tried looking for an FAQ page, I've tried searching the forums for similar problems or a place for beginners, I've tried searching Google for similar problems.

I literally have no idea what I'm supposed to do to get jPCT to work. xD

Please halp. :D

System specs:
Windows7x64
ASUS P5Q SE Plus
nVidia Geforce 9800GT
4gb DDR2 RAM
1440x900x32@60Hz
Java7 using Netbeans 7.0.1

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11775
    • View Profile
    • http://www.jpct.net
Re: Getting jPCT to work
« Reply #1 on: December 28, 2011, 09:50:21 pm »
Make sure that you are using graphics drivers from nVidia, not the ones that come with Windows. If that's given, player do a Logger.setLogLevel(Logger.LL_VERBOSE); at the beginning of your code to see which modes the driver reports and report these back here...

Offline Cowbox

  • int
  • **
  • Posts: 58
  • >:D
    • View Profile
    • Soharix
Re: Getting jPCT to work
« Reply #2 on: December 28, 2011, 09:57:38 pm »
I ran that at the beginning of the main method on Advanced example and got this:
Code: [Select]
run:
Loading Texture...example/GrassSample2.jpg
[ Wed Dec 28 20:57:04 GMT 2011 ] - ERROR: File 'example/GrassSample2.jpg' not found - replacement texture used instead!
Loading Texture...example/disco.jpg
[ Wed Dec 28 20:57:04 GMT 2011 ] - ERROR: File 'example/disco.jpg' not found - replacement texture used instead!
Loading Texture...example/rock.jpg
[ Wed Dec 28 20:57:04 GMT 2011 ] - ERROR: File 'example/rock.jpg' not found - replacement texture used instead!
Loading Texture...example/normals.jpg
[ Wed Dec 28 20:57:04 GMT 2011 ] - ERROR: File 'example/normals.jpg' not found - replacement texture used instead!
Loading Texture...example/sky.jpg
[ Wed Dec 28 20:57:04 GMT 2011 ] - ERROR: File 'example/sky.jpg' not found - replacement texture used instead!
Java version is: 1.7.0
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
mode: 800/600/32/75
mode: 720/576/32/60
mode: 1280/720/16/60
mode: 1152/864/32/60
mode: 640/480/16/75
mode: 1280/960/16/60
mode: 1280/1024/32/60
mode: 1366/768/16/60
mode: 1024/768/32/75
mode: 1152/720/16/60
mode: 1360/768/16/60
mode: 720/480/32/60
mode: 1024/768/16/75
mode: 1366/768/32/60
mode: 1152/720/32/60
mode: 1360/768/32/60
mode: 720/480/16/60
mode: 800/600/16/75
mode: 720/576/16/60
mode: 1280/1024/16/60
mode: 1280/960/32/60
mode: 640/480/32/75
mode: 1152/864/16/60
mode: 1280/720/32/60
mode: 1280/768/16/60
mode: 800/600/16/60
mode: 720/576/16/75
mode: 640/480/32/59
mode: 1280/1024/16/75
mode: 640/480/32/60
mode: 1024/768/16/60
mode: 1280/800/32/60
mode: 1440/900/32/60
mode: 720/480/16/75
mode: 1280/800/16/60
mode: 1024/768/32/60
mode: 1440/900/16/60
mode: 720/480/32/75
mode: 800/600/32/60
mode: 1280/768/32/60
mode: 720/576/32/75
mode: 640/480/16/59
mode: 640/480/16/60
mode: 1280/1024/32/75
Can't find desired videomode (800 x 600 x 24) - searching for alternatives
Current mode:800 x 600 x 32 @75Hz
[ Wed Dec 28 20:57:05 GMT 2011 ] - WARNING: ZBuffer depth of 24 not supported - trying something else now...!
[ Wed Dec 28 20:57:05 GMT 2011 ] - WARNING: Does this machine actually support OpenGL? Trying everything at lowest settings now!
java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.WindowsDisplay.nSetTitle(JJ)V
at org.lwjgl.opengl.WindowsDisplay.nSetTitle(Native Method)
at org.lwjgl.opengl.WindowsDisplay.setTitle(WindowsDisplay.java:442)
at org.lwjgl.opengl.Display.setTitle(Display.java:567)
at org.lwjgl.opengl.Display.createWindow(Display.java:312)
at org.lwjgl.opengl.Display.create(Display.java:899)
at org.lwjgl.opengl.Display.create(Display.java:808)
Driver is unknown!
at com.threed.jpct.GLHelper.init(Unknown Source)
[ Wed Dec 28 20:57:05 GMT 2011 ] - ERROR: Unable to set any valid videomode on this machine!
[ Wed Dec 28 20:57:05 GMT 2011 ] - ERROR: Can't set videomode - try different settings!
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
Software renderer disposed
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
Loading file example/rock.3ds
[ Wed Dec 28 20:57:05 GMT 2011 ] - ERROR: Couldn't read file example/rock.3ds
[ Wed Dec 28 20:57:05 GMT 2011 ] - ERROR: Not a valid 3DS file!
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at rats.Rats.init(Rats.java:121)
at rats.Rats.main(Rats.java:56)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)

I'm reasonably certain my graphics drivers are up to date as I regularly update them from the nVidia site. :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11775
    • View Profile
    • http://www.jpct.net
Re: Getting jPCT to work
« Reply #3 on: December 28, 2011, 10:15:18 pm »
Make sure that the lwjgl dlls are in your library path and that you are using the ones that belong to the version of lwjgl that you are using. Something is fishy with your setup in this regard:

Quote
java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.WindowsDisplay.nSetTitle(JJ)V

Offline Cowbox

  • int
  • **
  • Posts: 58
  • >:D
    • View Profile
    • Soharix
Re: Getting jPCT to work
« Reply #4 on: December 29, 2011, 07:29:39 pm »
Ok I just copied all the .dlls into the same path as jpct.jar and the lwjgl.jars and now I'm getting this output in console:
Code: [Select]
run:
Loading Texture...example/GrassSample2.jpg
[ Thu Dec 29 18:29:02 GMT 2011 ] - ERROR: File 'example/GrassSample2.jpg' not found - replacement texture used instead!
Loading Texture...example/disco.jpg
[ Thu Dec 29 18:29:02 GMT 2011 ] - ERROR: File 'example/disco.jpg' not found - replacement texture used instead!
Loading Texture...example/rock.jpg
[ Thu Dec 29 18:29:02 GMT 2011 ] - ERROR: File 'example/rock.jpg' not found - replacement texture used instead!
Loading Texture...example/normals.jpg
[ Thu Dec 29 18:29:02 GMT 2011 ] - ERROR: File 'example/normals.jpg' not found - replacement texture used instead!
Loading Texture...example/sky.jpg
[ Thu Dec 29 18:29:02 GMT 2011 ] - ERROR: File 'example/sky.jpg' not found - replacement texture used instead!
Java version is: 1.7.0
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
mode: 800/600/32/75
mode: 720/576/32/60
mode: 1280/720/16/60
mode: 1152/864/32/60
mode: 640/480/16/75
mode: 1280/960/16/60
mode: 1280/1024/32/60
mode: 1366/768/16/60
mode: 1024/768/32/75
mode: 1152/720/16/60
mode: 1360/768/16/60
mode: 720/480/32/60
mode: 1024/768/16/75
mode: 1366/768/32/60
mode: 1152/720/32/60
mode: 1360/768/32/60
mode: 720/480/16/60
mode: 800/600/16/75
mode: 720/576/16/60
mode: 1280/1024/16/60
mode: 1280/960/32/60
mode: 640/480/32/75
mode: 1152/864/16/60
mode: 1280/720/32/60
mode: 1280/768/16/60
mode: 800/600/16/60
mode: 720/576/16/75
mode: 640/480/32/59
mode: 1280/1024/16/75
mode: 640/480/32/60
mode: 1024/768/16/60
mode: 1280/800/32/60
mode: 1440/900/32/60
mode: 720/480/16/75
mode: 1280/800/16/60
mode: 1024/768/32/60
mode: 1440/900/16/60
mode: 720/480/32/75
mode: 800/600/32/60
mode: 1280/768/32/60
mode: 720/576/32/75
mode: 640/480/16/59
mode: 640/480/16/60
mode: 1280/1024/32/75
Can't find desired videomode (800 x 600 x 24) - searching for alternatives
Current mode:800 x 600 x 32 @75Hz
[ Thu Dec 29 18:29:03 GMT 2011 ] - WARNING: ZBuffer depth of 24 not supported - trying something else now...!
[ Thu Dec 29 18:29:03 GMT 2011 ] - WARNING: Does this machine actually support OpenGL? Trying everything at lowest settings now!
java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.WindowsDisplay.nSetTitle(JJ)V
at org.lwjgl.opengl.WindowsDisplay.nSetTitle(Native Method)
at org.lwjgl.opengl.WindowsDisplay.setTitle(WindowsDisplay.java:442)
at org.lwjgl.opengl.Display.setTitle(Display.java:567)
at org.lwjgl.opengl.Display.createWindow(Display.java:312)
at org.lwjgl.opengl.Display.create(Display.java:899)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
java.lang.IllegalStateException: Only one LWJGL context may be instantiated at any one time.
at org.lwjgl.opengl.Display.create(Display.java:870)
at org.lwjgl.opengl.Display.create(Display.java:808)
at com.threed.jpct.GLHelper.init(Unknown Source)
at com.threed.jpct.GLRenderer.init(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at com.threed.jpct.FrameBuffer.enableRenderer(Unknown Source)
at rats.Rats.init(Rats.java:94)
at rats.Rats.main(Rats.java:56)
Driver is unknown!
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
[ Thu Dec 29 18:29:03 GMT 2011 ] - ERROR: Unable to set any valid videomode on this machine!
at rats.Rats.init(Rats.java:121)
at rats.Rats.main(Rats.java:56)
[ Thu Dec 29 18:29:03 GMT 2011 ] - ERROR: Can't set videomode - try different settings!
Software renderer disposed
Loading file example/rock.3ds
[ Thu Dec 29 18:29:03 GMT 2011 ] - ERROR: Couldn't read file example/rock.3ds
[ Thu Dec 29 18:29:03 GMT 2011 ] - ERROR: Not a valid 3DS file!
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11775
    • View Profile
    • http://www.jpct.net
Re: Getting jPCT to work
« Reply #5 on: December 29, 2011, 09:23:23 pm »
That's the same thing as before...

Quote
java.lang.UnsatisfiedLinkError: org.lwjgl.opengl.WindowsDisplay.nSetTitle(JJ)V

The error indicates that it does find some lwjgl dlls but they don't contain that method, which bascially means that they don't match the jars. Copying the dlls alone doesn't cut it...you have to set the -Djava.library.path property somewhere or copy the dlls to a directory where Java looks for native files by default. Maybe this has happended for whatever reason on your machine, so that it now finds outdated dlls. Try a system wide search for "lwjgl.dll" to see if it reveals something....

Offline Cowbox

  • int
  • **
  • Posts: 58
  • >:D
    • View Profile
    • Soharix
Re: Getting jPCT to work
« Reply #6 on: December 29, 2011, 10:02:32 pm »
 ;D

It worked :D!

I was about to go and get the VM options I'd put in place to show you that I had it all set up correctly then I realised I was linking to what I can only imagine was the Slick2D LWJGL dlls in a similar, but not entirely the same folder. :D

So after correcting the file route and taking out Logger.setLogLevel(Logger.LL_VERBOSE); (which seemed to crash it after a few seconds) I get this:

:D!!!!!