Ran beautifully on my 3yo XP 2.8Ghz single core. Interestingly, rotating and zoom took almost no CPU resources at all (< 10%), moving the map around took everything available.
Hmmm… That’s not good. There might be a better way to do that, but I’ll have to think about it.
Right now, in order to pan the map, the program has to figure out where the cursor is relative to the map itself so that it can be translated by the right amount. To undo the vertex and perspective transformations requires calculating the inverse of two 4x4 matrices which is done by the CPU. The transformation matrices are simple enough I can probably do the calculations manually, but I’m surprised that it takes that much effort.
Zooming is surprisingly easy. I was more worried about the rotations because of two calls to Math.atan2().
Just looked at cycle usage on my Linux laptop, but it doesn’t use hardware acceleration, so all operations cause cycle usage to hit 100%. However, the nice thing (no pun intended) is that it doesn’t appear to affect the graphics performance at all. It’s surprisingly quite smooth.
Has anyone tried this on the mac yet?
M.
2008/5/6 Michael Kiefte <mkiefte@dal.ca (mkiefte@dal.ca)>:
Or it could just be all the calls to System.out.println(). I eliminated those and it’s quite a bit easier on the CPU.
m.
2008/5/6 Michael Kiefte <mkiefte@dal.ca (mkiefte@dal.ca)>:
–
Michael Kiefte, Ph.D.
Associate Professor
School of Human Communication Disorders
Dalhousie University
Halifax, Nova Scotia, Canada
tel: +1 902 494 5150
fax: +1 902 494 5151
I’m always surprised at how much load someting simple like printing
diagnostic output imposes. Either those pathways are not well-optmized,
or printing to stdout is much more computationally-intensive than it
appears.
I should be more specific. It’s not the calls to System.out.println() bogging it down, it’s Double.toString() that brings it to a crawl in the call to System.out.println(). I haven’t tried it again on Windows, but on my unaccelerated antique, panning now consumes fewer cycles than zooming or rotating. On it’s own System.out.println() is not that bad, but it’s still relativey expensive for sure.
Mac OS X, 10.5.2, Intel 64bit Core Duo, 2.4Ghz
Java™ SE Runtime Environment (build 1.6.0_05-b13-120)
Java HotSpot™ 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode)
NOTE: You may need to specify that Java 1.6 is needed to run this.
Apple just last week released a Java 1.6 version for the Mac, so most
Mac users will not have that version yet. There is no Java 1.6 for
Mac OS X, 10.4.x except as an old Developer release alpha version.
Original TextureDemo on Mac.
Fails with link error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: /Users/tar/
Downloads/TextureDemo-2/maclib/libjogl.jnilib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
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
.macosx.MacOSXGLDrawableFactory.(MacOSXGLDrawableFactory.java:
53)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at
javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:
108)
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 TextureDemo.main(TextureDemo.java:56)
MipmapDemo fails in the same way (except that the TextureDemo.java
linenumber is 100 instead).
I’ve been following this on java-dev@lists.apple.com. The release of
1.6 is for OS X 10.5 and Intel 64-bit only. So far as I know, Apple
has said nothing about releasing it for older versions of OS X or
other architectures, which makes it useless for us.
(An aside: This hits rights on the nose my ever-growing dislike for
closed-source software, as it puts us at the mercy of a third party…
If this was all an open-source effort, there would have had hordes of
volunteers and we would have had Java 1.6 on the Mac, on all
architectures, years ago. I can’t blame Apple completely for this, as
they would have needed Sun to have opened all of the JDK by then, but
that just means that Sun should also have done that a decade ago,
rather than, what, a year ago?)
Does it not run with Java 1.5? I did a quick Google search and found some notes that suggest that Java 1.6 is not going to work until the JOGL libraries are recompiled. I don’t see any reason why Java 1.5 wouldn’t work though.
On May 7, 2008, at 11:10 AM, Michael Kiefte wrote:
I suspect something isn’t compiled for the 1.5 version. Trying to
load in Java 1.5, I get a bad class version error, which goes away
when I use Java 1.6:
Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad
version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
Well this worked for me at work on Win XP 32, but none of the demos will run for me here at home – Win XP 64.
Bat file pops up a command prompt box real fast then disappears and that all that happens
Java was 1.6.0_05 on each machine – possible configuration problem?