LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: elias on November 11, 2004, 16:08:03

Title: Mac OS X port ready
Post by: elias on November 11, 2004, 16:08:03
... at least ready enough for comments and testing. The files are at:

http://odense.kollegienet.dk/~naur/liblwjgl.jnilib

and

http://odense.kollegienet.dk/~naur/lwjgl.jar

and

http://odense.kollegienet.dk/~naur/openal.dylib

The port is pretty much complete, with some known issues:

1. No Controller support
2. No Pbuffer support. 10.2 have only in-memory pbuffers, and 10.3 only have render-to-texture, so we'll have to restructure the LWJGL Pbuffer interface to make Mac OS X fit.
3. Mode capping. This happens on my Mac, but apparantly not on e.g. Scott Palmer's. See

http://www.javagaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1100087097

for a full explanation.
4. Native cursors are reset to the default cursors when the LWJGL window is deactivated and then re-activated. Looks like an AWT bug, because even the simplest program exhibits this behaviour:


import java.awt.*;
import javax.swing.*;

public class cursortest {
   public static void main(String[] args) {
       JFrame f = new JFrame();
       Button b = new Button();
       f.getContentPane().add(b);
       f.pack();
       f.setBounds(10, 10, 100, 100);
       f.setVisible(true);
       b.setLabel("Waiting cursor here");
       b.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   }
}


The cursor is always the waiting cursor (even when the cursor is outside the button), but after deactivation, the default pointer is shown, always. Another setCursor doesn't help, and getCursor returns the correct cursor too.

5. When in fullscreen and using native cursors, no mouse moved events are reported in the top few pixels of the window. Don't know what is causing this.

- elias

[EDIT] Issue 6 is fixed
Title: Mac OS X port ready
Post by: elias on November 11, 2004, 16:12:51
... and I almosts forgot

7. Only a boneheaded Makefile for the native library in src/native/macosx. I'm sure someone will have mercy and createa better build system.

 - elias
Title: Mac OS X port ready
Post by: Chman on November 11, 2004, 16:43:43
Nice work !!!
This binding has been waited by so many people...
Thanks !

Chman
Title: Mac OS X port ready
Post by: elias on November 11, 2004, 16:51:02
Thank you. As a measure of stability, I can tell you that Tribal Trouble runs flawlessly on the Mac now, and we've even tried a networked game against all the other LWJGL platforms :-)

- elias
Title: Mac OS X port ready
Post by: Chman on November 11, 2004, 17:46:42
That's good ! I'm also waiting for tribal trouble which looks more and more interesting !

Chman
Title: Mac OS X port ready
Post by: Erestar on November 11, 2004, 19:52:45
Speaking of Tribal Trouble, I sighed up on the forum when I saw the beta stuff was starting, but I guess I picked the 13 or under option. I emailed someone about this but forget who and never heard back.

Can anyone fix me? ;)

Erestar
Title: Mac OS X port ready
Post by: elias on November 11, 2004, 20:06:05
If you filled out the beta application form, we have you in the system :-) In a few days we'll let in a lot more testers to stress the multiplayer part of the game. For now, we only have a few testers to make sure everything runs alright.

- elias
Title: Mac OS X port ready
Post by: the2bears on November 12, 2004, 14:36:51
Quote from: "elias"Thank you. As a measure of stability, I can tell you that Tribal Trouble runs flawlessly on the Mac now, and we've even tried a networked game against all the other LWJGL platforms :-)

- elias

That is just really cool!  Congratulations both for the Mac port and TT.

Bill
Title: Mac OS X port ready
Post by: itistoday on November 12, 2004, 22:59:46
I'm getting a LOT of errors trying to run programs with this.  Most of them seem to be caused by a lack of a "Display" or "Window" class.  I'm new to lwjgl so bear with me.

Example errors from javac:
Lesson01.java:9: cannot resolve symbol
symbol  : class Display
location: package lwjgl
import org.lwjgl.Display;
                ^
Lesson01.java:10: cannot resolve symbol
symbol  : class DisplayMode
location: package lwjgl
import org.lwjgl.DisplayMode;
                ^
Lesson01.java:12: cannot resolve symbol
symbol  : class Window
location: package opengl
import org.lwjgl.opengl.Window;

I've put the posted files in my ~/Library/Java/Extensions/ folder. On a mac, this both the java.ext.dirs folder and the java.library.path folder.
Title: Mac OS X port ready
Post by: trevorsm on November 12, 2004, 23:37:19
Quote from: "itistoday"I'm getting a LOT of errors trying to run programs with this.  Most of them seem to be caused by a lack of a "Display" or "Window" class.  I'm new to lwjgl so bear with me.

I had a problem with this too: it seems that LWJGL changes around a bit from time to time. In this particular case, the org.lwjgl.opengl.Window class is gone and Display has moved to org.lwjgl.opengl.Display, which seems to have broken programs that ran on older versions of LWJGL.

Check the Sample Code section in the LWJGL Wiki for code that works with the newer library. http://lwjgl.org/wiki/tiki-index.php?page=Basic+Game+FrameworkThis is a good bet, but you'll have to remove the static imports from the code since Apple hasn't released Java 1.5 for OSX yet. :evil:
Title: Mac OS X port ready
Post by: itistoday on November 12, 2004, 23:45:46
Quote from: "trevorsm"
Quote from: "itistoday"I'm getting a LOT of errors trying to run programs with this.  Most of them seem to be caused by a lack of a "Display" or "Window" class.  I'm new to lwjgl so bear with me.

I had a problem with this too: it seems that LWJGL changes around a bit from time to time. In this particular case, the org.lwjgl.opengl.Window class is gone and Display has moved to org.lwjgl.opengl.Display, which seems to have broken programs that ran on older versions of LWJGL.

Check the Sample Code section in the LWJGL Wiki for code that works with the newer library. http://lwjgl.org/wiki/tiki-index.php?page=Basic+Game+Framework is a good bet, but you'll have to remove the static imports from the code since Apple hasn't released Java 1.5 for OSX yet. :evil:
I remove the static from the imports and get this error:

/Users/gslepak/Desktop/Java Stuff/lwjgl/demos/Game.java:18: ';' expected
private static enum       gameStates {INIT, RUNNING, EXIT};
                                            ^
/Users/gslepak/Desktop/Java Stuff/lwjgl/demos/Game.java:74: ';' expected
for (DisplayMode currentMode : modes) {
                                                    ^
/Users/gslepak/Desktop/Java Stuff/lwjgl/demos/Game.java:83: illegal start of expression
} catch (Exception e) {
               ^
3 errors
Title: Mac OS X port ready
Post by: trevorsm on November 13, 2004, 00:07:48
Has anyone else been having trouble getting keyboard input to work? I've been trying to use the Keyboard.isKeyDown() function, but it always returns false. The same code I've been tring works fine on Windows.
Title: Mac OS X port ready
Post by: itistoday on November 13, 2004, 00:12:36
Quote from: "trevorsm"Has anyone else been having trouble getting keyboard input to work? I've been trying to use the Keyboard.isKeyDown() function, but it always returns false. The same code I've been tring works fine on Windows.
(thanks for the pm).
Doesn't work for me either.  Why does LWJGL even have keyboard/mouse support? Shouldn't this all be done by AWT/Swing?
Title: Mac OS X port ready
Post by: Gom Jabbar on November 13, 2004, 00:22:46
Quote from: "itistoday"I remove the static from the imports and get this error:

/Users/gslepak/Desktop/Java Stuff/lwjgl/demos/Game.java:18: ';' expected
private static enum       gameStates {INIT, RUNNING, EXIT};
                                            ^
/Users/gslepak/Desktop/Java Stuff/lwjgl/demos/Game.java:74: ';' expected
for (DisplayMode currentMode : modes) {
                                                    ^
/Users/gslepak/Desktop/Java Stuff/lwjgl/demos/Game.java:83: illegal start of expression
} catch (Exception e) {
               ^
3 errors

You have to redo that bit too, Enum's aren't supported prior to Java 1.5 either. Just throw out all references to gameState(s) and add a boolean to keep track of whether the game is running or not. If you don't know how to do this give me a shout and I'll post some source...
Title: Mac OS X port ready
Post by: Gom Jabbar on November 13, 2004, 00:27:51
Damn, I just realized that the for loop won't work in Java versions < 1.5 either.

I'm gonna add some comment to the Basic Game Framework code clarifying this and provide alternative ways of doing it in earlier versions. I hope to get it done in some minutes, if not I fell asleep and will do it tomorrow. Afterall it's 1:45 am already...
Title: Mac OS X port ready
Post by: itistoday on November 13, 2004, 00:28:07
Quote from: "Gom Jabbar"You have to redo that bit too, Enum's aren't supported prior to Java 1.5 either. Just throw out all references to gameState(s) and add a boolean to keep track of whether the game is running or not. If you don't know how to do this give me a shout and I'll post some source...
It's alright thanks, trevorsm PM'd me a working copy :)
Title: Mac OS X port ready
Post by: Gom Jabbar on November 13, 2004, 00:55:44
I updated the code anyway! :D

http://lwjgl.org/wiki/tiki-index.php?page=Basic+Game+Framework

I haven't tested it yet - as I'm honestly too lazy for that right now - but from how it looks it should work :).
Title: Mac OS X port ready
Post by: itistoday on November 13, 2004, 03:06:31
Quote from: "Gom Jabbar"I updated the code anyway! :D

http://lwjgl.org/wiki/tiki-index.php?page=Basic+Game+Framework

I haven't tested it yet - as I'm honestly too lazy for that right now - but from how it looks it should work :).
Ok thanks a bunch!
Title: Mac OS X port ready
Post by: elias on November 13, 2004, 08:30:28
The isKeyDown() issue has been fixed in CVS.

- elias
Title: Mac OS X port ready
Post by: elias on November 13, 2004, 08:32:41
And I've updated the libraries on odense.kollegienet.dk.

- elias
Title: Mac OS X port ready
Post by: itistoday on November 13, 2004, 15:34:56
Quote from: "elias"The isKeyDown() issue has been fixed in CVS.

- elias
Thanks, but how exactly do I compile all this?  I went to lwjgl's sourceforge page and got the CVS source, and ran 'ant' in the main directory (had to make a folder called bin or it wouldn't work), which seemed to build the classes (but didn't put them into a jar file, oh well).  But I can't seem to figure out how to compile the native library.  How do I do that?
Title: Mac OS X port ready
Post by: elias on November 13, 2004, 15:45:16
the jarring command is "ant jars", and to buld the native part you'll have to live with the crude Makefile in src/native/macosx. Go in there and run "make" to create the liblwjgl.jnilib.

- elias
Title: Mac OS X port ready
Post by: itistoday on November 13, 2004, 15:59:01
Quote from: "elias"the jarring command is "ant jars", and to buld the native part you'll have to live with the crude Makefile in src/native/macosx. Go in there and run "make" to create the liblwjgl.jnilib.

- elias
"ant jars" does not seems to be a "valid target", but when I tried "ant all" I got a lot of stuff going :)
However, when it tried to compile the native library it gave me this:
[exec] /Developer/Private/jam -d2 -j2 JAMBASE=/Developer/Makefiles/pbx_jamfiles/ProjectBuilderJambase JAMFILE=- build ACTION=build _DEFAULT_GCC_VERSION=3.3 "CPP_HEADERMAP_FILE=/Users/gslepak/Desktop/Java Stuff/lwjgl/CVS/lwjgl/platform_build/mac_xcode/build/mac_xcode.build/JNILib.build/liblwjgl.jnilib.hmap" "SRCROOT=/Users/gslepak/Desktop/Java Stuff/lwjgl/CVS/lwjgl/platform_build/mac_xcode" "OBJROOT=/Users/gslepak/Desktop/Java Stuff/lwjgl/CVS/lwjgl/platform_build/mac_xcode/build" "SYMROOT=/Users/gslepak/Desktop/Java Stuff/lwjgl/CVS/lwjgl/platform_build/mac_xcode/build" DSTROOT=/tmp/mac_xcode.dst

    [exec] Missing file or directory: ../../src/native/macosx/hid.cpp
    [exec] Missing file or directory: ../../src/native/macosx/org_lwjgl_Display.cpp
...

And attempting to manually do a 'make' in the macosx native dir I get this:
gcc -fPIC -O2 -D_MACOSX -Wall -c -I/Users/oddlabs/cvs/openal/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers org_lwjgl_Sys.c -o org_lwjgl_Sys.o
gcc -fPIC -O2 -D_MACOSX -Wall -c -I/Users/oddlabs/cvs/openal/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers org_lwjgl_input_Mouse.c -o org_lwjgl_input_Mouse.o
gcc -fPIC -O2 -D_MACOSX -Wall -c -I/Users/oddlabs/cvs/openal/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers org_lwjgl_opengl_Pbuffer.c -o org_lwjgl_opengl_Pbuffer.o
gcc -fPIC -O2 -D_MACOSX -Wall -c -I/Users/oddlabs/cvs/openal/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers ../common/common_tools.c -o ../common/common_tools.o
gcc -fPIC -O2 -D_MACOSX -Wall -c -I/Users/oddlabs/cvs/openal/include -I../common -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers ../common/extal.c -o ../common/extal.o
In file included from ../common/extal.c:36:
../common/extal.h:49:25: AL/alctypes.h: No such file or directory
../common/extal.h:50:24: AL/altypes.h: No such file or directory
In file included from ../common/extal.c:36:
../common/extal.h:107: error: parse error before '*' token
../common/extal.h:107: error: parse error before "capability"
../common/extal.h:107: warning: type defaults to `int' in declaration of `ALvoid'
../common/extal.h:107: error: `ALvoid' declared as function returning a function
../common/extal.h:108: error: parse error before '*' token
../common/extal.h:108: error: parse error before '*' token
...

It seems it's using your username's path to try to find stuff.... And it can't seem to find the stuff in ../commons... :(
Title: Mac OS X port ready
Post by: trevorsm on November 13, 2004, 18:08:13
Quote from: "itistoday"And attempting to manually do a 'make' in the macosx native dir I get this:

You need to download the OpenAL framework/headers.

EDIT:
The installer at http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=97 ought to work fine.
Title: Mac OS X port ready
Post by: trevorsm on November 13, 2004, 18:16:38
Quote from: "elias"The isKeyDown() issue has been fixed in CVS.

And I've updated the libraries on odense.kollegienet.dk.

Thanks a bunch!
Title: Mac OS X port ready
Post by: itistoday on November 14, 2004, 02:04:52
Quote from: "trevorsm"
Quote from: "itistoday"And attempting to manually do a 'make' in the macosx native dir I get this:

You need to download the OpenAL framework/headers.

EDIT:
The installer at http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=97 ought to work fine.
Downloaded it, installed it, still doesn't work.

The make file contains this line:
AL=/Users/oddlabs/cvs/openal

I think I need to change that to something.
Title: Mac OS X port ready
Post by: renanse on November 17, 2004, 16:18:04
This is great, thanks elias!  Only 1 question...  Is Pbuffer support forthcoming?  Sorry, if I sound ungrateful, just want to add as much lwjgl-Mac support as I can in jME.  :)
Title: Mac OS X port ready
Post by: elias on November 17, 2004, 19:05:17
Soon, I think. It seems that I was hasty when dismissing the 10.3 pbuffers as incompatible with LWJGL semantics, as it is possible to use it as regular offscreen buffers.

- elias
Title: Mac OS X port ready
Post by: elias on November 18, 2004, 11:57:54
Pbuffer support has been comitted to CVS.

- elias
Title: Mac OS X port ready
Post by: javac on November 18, 2004, 12:39:22
This is looking great elias, thanks for all your work on it so far.

I'm not experiencing 'mode capping' myself. I'm currently using jME and can run at 1280x1024 on my lowly G4 533DP, OSX 10.3, Java 1.4.2_05.
Title: Mac OS X port ready
Post by: elias on November 18, 2004, 12:45:39
Yes,  the mode capping is indeed a weird problem. If I connect a 19" TFT monitor to the machine, the problem disappears. It's only a problem on my lowly CRT 19" screen (even though I can run 1280*1024 on it by using the control panel).

- elias
Title: Mac OS X port ready
Post by: renanse on November 18, 2004, 16:06:18
Hey elias, any chance of getting updated libs with the pbuffer support?  Thanks!
Title: Mac OS X port ready
Post by: elias on November 18, 2004, 19:03:45
Yes of course. The files linked from the first post has been updated. The lwjgl.jar will need updated linux and win32 libraries. Maybe it's time for a new release :)

- elias
Title: Mac OS X port ready
Post by: renanse on November 18, 2004, 20:25:05
Quote from: "elias"Soon, I think. It seems that I was hasty when dismissing the 10.3 pbuffers as incompatible with LWJGL semantics, as it is possible to use it as regular offscreen buffers.

- elias
Well, your pbuffers work on my Mac, but man are they slow...  Almost to the point of being unusable.  Is it being done in software mode or something like that?  for reference, my Mac is a powerbook G4 1.5GHz, 1GB RAM with an ATI Mobility Radeon 9700 holding 128MB of DDR SDRAM.  (So I'd think it would scream pretty nicely through these OpenGL tasks...)
Title: Mac OS X port ready
Post by: elias on November 18, 2004, 21:54:05
I dunno, I use them for "just-in-time" generation of otherwise static textures. Maybe because they're tuned to rendering directly to a texture, I don't know. RTT will have to be generalised to cover both win32 and mac to enable it (linux does not seem to have an RTT implementation).

- elias
Title: Mac OS X port ready
Post by: renanse on November 19, 2004, 15:03:35
Cool, if RTT can be supported that would be awesome!!
Title: Mac OS X port ready
Post by: tone on November 20, 2004, 16:11:02
Quote
http://odense.kollegienet.dk/~naur/liblwjgl.jnilib

and

http://odense.kollegienet.dk/~naur/lwjgl.jar

and

http://odense.kollegienet.dk/~naur/openal.dylib

These links are unresponsive as far as I can tell.
Have they been moved elsewhere?


tone
Title: Mac OS X port ready
Post by: princec on November 20, 2004, 17:20:55
Site looks temporarily down.

Cas :)
Title: Mac OS X port ready
Post by: tone on November 20, 2004, 23:28:58
It got bettah!

tone
Title: Mac OS X port ready
Post by: renanse on December 01, 2004, 16:35:37
Any thoughts on support for render to texture?  pbuffer on osx is so slow currently.  :(
Title: Mac OS X port ready
Post by: elias on December 02, 2004, 02:48:17
I don't have plans for implementing render-to-texture in the near future (TT is nearing completion and I want to devote resources to that). Your best bet if you need it right now is Spasi who did the win32 RTT implementation. Personally I'm more interested in the upcoming platform independent (Linux GLX doesn't even support RTT as far as I know) extension that allows rendering directly from the main context to a texture.

- elias
Title: Mac OS X port ready
Post by: spasi on December 02, 2004, 04:22:05
Sorry, no Macs here.

But, why are pbuffers slow on renanse's machine? Adding render-to-texture won't improve the situation if simple pbuffer rendering is already dog-slow. We should try it on other machines too, maybe it's something in the implementation.

Anyway, I took a look at Apple's site and it seems that there is proper full support for both pbuffers and render-to-texture. I guess we should just wait for Elias' post-TT relaxation. :wink: (Edit: Of course, by that time, I'd expect ARB_framebuffer_object to be out of the ARB dungeons...)

Elias, have you seen anything in OSX's headers about what render-to-texture "types" are supported? I mean, except simple 2D textures, do they support cube, depth and/or rectangle textures? I'm more interested in depth textures specifically...:wink:
Title: Mac OS X port ready
Post by: elias on December 02, 2004, 08:59:51
Haven't really studied it, as it was quite different from win32 and the lack of support for linux had me turned off already... I'm hoping for the ARB extension too...

- elias
Title: Mac OS X port ready
Post by: willdenniss on December 03, 2004, 19:18:22
Quote from: "elias"Yes of course. The files linked from the first post has been updated. The lwjgl.jar will need updated linux and win32 libraries. Maybe it's time for a new release :)

- elias

A new release would be very good :-)  I'm hoping to add the libs for all three platforms to Xith3D and it would be great if they were all the same version.

Will.
Title: Mac OS X port ready
Post by: imjustmatthew on December 06, 2004, 11:08:10
Quote from: "elias"Yes of course. The files linked from the first post has been updated. The lwjgl.jar will need updated linux and win32 libraries. Maybe it's time for a new release :)

- elias

Yeah, a new release with the macosx port included as part of the standard distribution would be great.

Thanks, Elias, for the port, it'll be a great help.
Title: Mac OS X port ready
Post by: willdenniss on December 06, 2004, 18:09:58
Yes, thanks for the excellent port.  Everything is working really well on my Mac.

Will.
Title: Mac OS X port ready
Post by: willdenniss on December 14, 2004, 01:03:38
*bump*

Can we please have a new release with all 3 platforms so everything is the same version?

I am wishing to do a new release of Xith3D with the new LWJGL support.

Also, I appear to be missing the org.lwjgl.util package from the lwjgl.jar file I downloaded (the one at the start of this thread).  Is there a reason for this?  I am wanting to use the High-res timer.

EDIT:  Ok, I see that this Timer class is totally optional and can easily be compiled by oneself, the actual system call being "Sys.getTime()".

Thanks,

Will.
Title: Mac OS X port ready
Post by: Matzon on December 14, 2004, 06:33:59
It's comming!
It was going to be released yesterday, but I was supplied 0.93 versioned libs. I'll get a new batch today, and release tonight.
Title: Mac OS X port ready
Post by: willdenniss on December 14, 2004, 08:45:31
Quote from: "Matzon"It's comming!
It was going to be released yesterday, but I was supplied 0.93 versioned libs. I'll get a new batch today, and release tonight.

Awesome, thanks.

Will.
Title: Mac OS X port ready
Post by: itistoday on February 20, 2005, 04:33:30
Hmm.. I can no longer download from the links in the first post, 404 error.
Can we expect continued support for OS X? Is the mac port of 0.95 being worked on?
Title: Mac OS X port ready
Post by: Matzon on February 20, 2005, 10:04:12
whoa - no one is even remotely close to ditching OS X!!
Try selecting another SourceForge Mirror when downloading. Works fine for me.
Title: Mac OS X port ready
Post by: itistoday on February 20, 2005, 16:42:23
Ok cool! I forgot about that sourceforge page... :)