Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: PienueDut

26. May 2012, 10:20:35 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)MacOS X big endian
Pages: [1]
Print
Author Topic: MacOS X big endian  (Read 555 times)
Agrv
Administrator
Enjoying the stay
*****
Offline Offline

Posts: 64


View Profile
« on: 21. February 2009, 04:31:21 pm »

Hi,

I had the opportunity today to test my xith3d applet on a Mac OS X with bigendian processor, and here are two issues I found, with fixes.

System  : Mac OS X 10.5.4, ppc
Java    : Java HotSpot(TM) Client VM 1.5.0_13-119 (Apple Inc.), version 1.5.0_13

1) Sound loaded from an ogg file played only a big crackle ; I found that replacing the code at lines 314 and 315 of /xith3d/src/org/xith3d/loaders/sound/impl/ogg/OggSoundContainer.java with the following code fixes the problem. Not sure why we have to do that, I thought that "bbuffer.order( ByteOrder.nativeOrder() );" should handle the bigendian case.
Code:
// loop through the chunks and put them in the buffer
if(ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
for(byte[] chunk : chunks) {
for(int i = 0; i < chunk.length; i += 2) {
bbuffer.put(chunk[i + 1]);
bbuffer.put(chunk[i]);
}
}
}
else {
for ( byte[] chunk: chunks )
bbuffer.put( chunk );
}

2) The cursor once hidden displays something strange. Replacing the 1x1 EMPTY_CURSOR_IMAGE image with a 16x16 in /jagatoo/src/org/jagatoo/input/impl/awt/AWTCursorConverter.java on line 49 fixes it.
Code:
    private static final BufferedImage EMPTY_CURSOR_IMAGE = new BufferedImage( 16, 16, BufferedImage.TYPE_4BYTE_ABGR );

Apart from that everything worked fine.
« Last Edit: 21. February 2009, 04:40:54 pm by Agrv » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 22. February 2009, 12:35:55 am »

Thanks for the fix. Please checkout from SVN and inspect the changes in this file. I think, I found a slightly better solution.

Marvin
Logged
Agrv
Administrator
Enjoying the stay
*****
Offline Offline

Posts: 64


View Profile
« Reply #2 on: 22. February 2009, 02:08:47 pm »

Yes, it works perfectly. Nice work, thanks.

What about the cursor ? I guess that MacOS (at least the version I tested) or Apple's JVM cannot handle cursors with size less than 16x16, so it's using some raw memory data next to the image for the missing pixels. Sadly I found no sort of "getMinCursorSize()" anywhere.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 22. February 2009, 03:19:19 pm »

What about the cursor ? I guess that MacOS (at least the version I tested) or Apple's JVM cannot handle cursors with size less than 16x16, so it's using some raw memory data next to the image for the missing pixels. Sadly I found no sort of "getMinCursorSize()" anywhere.

Oh, I am very sorry. I missed that one. I have applied your fix now. Thanks for reminding me.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic