[quote]java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no jogl 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 com.sun.opengl.impl.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:189)
at com.sun.opengl.impl.NativeLibLoader.access$000(NativeLibLoader.java:49)
at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:80)
at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:103)
at com.sun.opengl.impl.NativeLibLoader.access$200(NativeLibLoader.java:49)
at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLibLoader.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.opengl.impl.NativeLibLoader.loadCore(NativeLibLoader.java:109)
at com.sun.opengl.impl.windows.WindowsGLDrawableFactory.(WindowsGLDrawableFactory.java:60)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:106)
at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
at javax.media.opengl.GLCanvas.(GLCanvas.java:131)
at javax.media.opengl.GLCanvas.(GLCanvas.java:90)
at javax.media.opengl.GLCanvas.(GLCanvas.java:83)
at Experiment.MainWindow.(MainWindow.java:122)
at Experiment.MainWindow.main(MainWindow.java:39)
… 9 more
[/quote]
I got an error trying to run it, seem related to missing native JOGL library in system path ?
Hmm. That’s strange. As I said, I haven’t used JOGL before, but I thought it only needed an extra line added to the JNLP file to work.
I’ll do a bit more reading on the subject…
Yes, I’d noticed that, and I don’t know what’s causing it. :-\ I don’t think I’m doing anything too unusual. The player’s position and angle are taken to be the camera’s position and angle, and glFrustrum() defines a standard projection. Whatever I’m doing wrong is probably a standard newbie mistake, so I’ll keep reading until I figure it out.
Nice, it looks very good for a tech demo, why don’t you just add bullets and make a spectre type game?
By the way, how hard was it to learn that much JOGL to do that? And since JOGL isn’t a scene-graph, why did you make your own (I assume this is what you did)?
Great demo.
EDIT: I just checked some of your source, and was surprised at how compact the code is! Only 10 or so source files, nice job. Looks like you’ve got the 3d maths skills. I resized the window up and made it full screen, and it still ran fast at 115 fps.
I have take a look to your code. I didn’t really get how you setup the perspective, i never use GL function to do that and allways use GLU function.
Why not using gluPerspective(ViewAngle, ViewPortRatio , NearPlane, FarPlane) ?
You’re right, gluPerspective() would’ve been easier to use than glFrustrum(), but as far as I can work out they do the same thing.
I’ve tried fiddling with the perspective and it seems much better now. I think the problem was that my viewing angle was set too wide, and that was making everything go fish-eyed. So I’ve narrowed the viewing angle and (sneaky!) moved the camera a little way behind the player so that the view doesn’t feel too narrow.
It’s pretty much all from the first 6 chapters/300 pages of the red book (“OpenGL Programming Guide”). Building objects out of polygons is reasonably straightforward, and that’s all the demo does really (since the clouds, mountains, etc. are actually 2D effects). Overall I’ve found OpenGL quite fun to use, although it’s pretty intimidating at times and it’s very easy to mistype a command and suddenly find that half of your polygons have vanished!
As for JOGL itself, I didn’t have too much trouble installing it and getting stuff to compile and run okay. As OpenGL bindings go, I can’t comment on whether it’s better or not than LWJGL. (It was basically a coin-toss that made me choose JOGL over LWJGL.)
[quote]And since JOGL isn’t a scene-graph, why did you make your own (I assume this is what you did)?
[/quote]
No scene-graph required! The set-up is so simple that I’m just drawing every tank and every pyramid each frame. The z-buffer in OpenGL keeps track of what’s being drawn in front of what. I probably should have a simple check in place so that I don’t bother trying to draw objects that are outside the viewing area (e.g., behind the player), but there are so few objects being drawn that I can’t imagine it would make much difference.