Java on the Mac

I bought a powerbook g4 and am having trouble getting java to work correctly. I installed OS X 10.4.1 and Xcode2 dev tools & slapped Netbeans 4.1 on top.

I compiled the exxample Anagram application Ok, but when running it got:

2005-05-21 23:43:32.085 java[942] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0xd803, name = 'java.ServiceProvider'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2005-05-21 23:43:32.085 java[942] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)

The app then ran apparently correctly. I wrote a console “Hello World” app & that ran without error. I installed Java 1.5 & configured it as the default JRE for apps, but still the same error. A search on google found some Oracle developers having a similar problem & solved it by mv’ing libraries when compiling. However that was for C. Maybe the java native libs are broke on OS X 10.4?

Secondly I fired up my Storm the Castle software rendered 3D applet using safari web-browser on the Mac and got less than 2FPS (count em thats TWO frames per second) on a 1.67GHz machine. I get around 40fps on a 2.8GHz Pentium PC. Ouch Ouch Ouch.

I wasn’t expecting 40fps because I hadn’t optimised out all the floating point in the inner loops, but this should only really make a relatively small difference. Ok, the mac clock frequency is less than the PC, but the powerPC processor is supposed to be faster than a Pentium at the clock rate. Even being pessimistic, surely the framerate shouldn’t have dropped below around 10 to 15fps.

Not very cross platform when it’s 20 times slower, perhaps only 15 times slower with a following wind.

Maybe I’ve made a ghastly mistake. Maybe it’s safari.

This machine seems to have a problem with the xx key too. I always get two xx’s for a single keypress. It might have to go back.

qwertyuiopasdfghjklzxxcvbnm - see two xx’s again

Argghhhhhhhhh!

/Edit - I think the keyboard debounce is not quite up to the job. I tweaked the acceptance delay in the ‘Universal Access’ (i.e. disabled) preferences a tad & that seems to have done the trick with the dodgy x’s (see a single x) x x x all singles - so the question is do I complain about it since the fix works fine.

/Edit - There’s definitely something duff about the x key, it starts sending ‘x’ when you just rest your finger on it. Looks like a noisy set of contacts. Will attempt to exchange machine. Sigh And this was my first mac.

/Edit - swapped it - now i can type xylophone, xmas and xanadu. Think I’ll go profile my app, if I can find where the appletview is :wink:

How are you doing your 3D? What are you rendiering to/with?

The Storm demo used software rendering, so the delay is either due to Hotspot on the mac not being as aggressive or more likely to do with my blitting a large ImageBuffer to the screen every frame.

The bufferedImage in question is created:

The code that fills the buffer is complex, but the inner loop is:

Finally the image is drawn on the screen using code similar to:

The Mac Java2D pipeline is 100% software, and then that’s layered on top of the rather complicated OSX rendering engine itself. It’s very slow. The actual JVM implementation itself is more or less on a par with the Intel Hotspot clients as far as I can tell.

If you want x-platform performance… you need LWJGL or JOGL and a thorough understanding of OpenGL.

Cas :slight_smile:

The new Java2D implementation in the latest (Mac) VM is meant to be a big improvement.

Kev

Thanks for the feedback chaps,

Kev: The 1.5.0 VM got me up to about 3FPS ;D

I have to agree with Cas, using java2D to shift large bitmaps about just doesn’t seem to work on the mac.

Maybe INT_RGB doesn’t match the underlying display capabilities & a painstaking conversion is taking place.

It will be interesting to see if my entry for LWJGL16k runs better :slight_smile: