LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: elias4444 on January 08, 2005, 15:47:14

Title: Mac bug? Or just his machine?
Post by: elias4444 on January 08, 2005, 15:47:14
I've got a friend who's been trying to run my game on his Mac (osX). He get's it downloaded via webstart, but then it just quits on him (before even showing the menu for the game - which isn't even an openGL window yet, but I do call lwjgl to get the screen resolution and position the window). He also tried Cas' SuperDudester, but it bombs out on him too (although he's able to play the very fun space-invaders type applet in the browser no problem).

Are others seeing these issues as well? Or does my friend just have a buggy Mac?

I'm wondering if it has something to do with the Mac port of lwjgl, or perhaps if there's something special I have to include in my code just for the Mac. (My game runs on windows and linux no problem, and with both java 1.4.2 and java 5).
Title: Mac bug? Or just his machine?
Post by: elias on January 09, 2005, 11:11:28
You need to be more specific. The OS, LWJGL and Java version is helpful, but a proper stack trace of the exception (if any) is best.

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 10, 2005, 19:26:16
I'd love to give you more, but I'm not sure how to collect it without having him install lwjgl manually on his machine and giving him the command to run at the prompt for java (I'm not sure he'd be able to do it). Webstart doesn't return a thing either. He said it just downloads everything, "begins" to launch the program, and then quits.

I'm mostly just curious if anyone else has seen anything similar. It could very possibly be his machine that's the main problem.
Title: Mac bug? Or just his machine?
Post by: princec on January 10, 2005, 21:22:26
You can get OSX to log stuff to a console file - it's in the Java control panel thingy.

Cas :)
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 11, 2005, 18:57:42
Well, I've never used a Mac myself, and apparently, he can't figure out how to load up the Java ControlPanel either.  :?

I'm starting to wonder though, since my games work fine on widows and linux, if the problem is with my method of storing the user preferences. I call the user.home system property, and then create a directory and file structure underneath that.

Does the Mac require anything different from widows and linux for that?
Title: Mac bug? Or just his machine?
Post by: princec on January 11, 2005, 22:21:39
Yes, as it happens - on OS X, app support data goes thusly:

/**
* Get the local app settings dir
* @return String
*/
private static String getSettingsDir() {
if (System.getProperty("os.name").startsWith("Mac OS")) {
return System.getProperty("user.home", "")+"/Library/Application Support";
} else {
return System.getProperty("user.home", "");
}
}

<edit>Have to add a bit of code for Linux that creates a .<gamename> dir there, as that's how Linuxians do it.

Cas :)
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 12, 2005, 01:39:33
Well, I fixed up my code as from above, but he still bombed out. I then had him try one of the games at www.puppygames.net via jnlp, and it bombed out on him too.

So, it's sounding like it may just be his Mac. Do Mac users have to do something special to get webstart working right?
Title: Mac bug? Or just his machine?
Post by: elias on January 12, 2005, 09:00:50
Seriously, get a stack trace out of it. It'll help you (to fix any game bugs) and/or us (to fix any LWJGL bugs) tremendously.

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 13, 2005, 00:01:10
Got one! I found someone else with a Mac, and they were having the exact same problems with my stuff and the puppygames stuff:


Java Web Start 1.4.2_05 Console, started Wed Jan 12 14:54:12 MST 2005 Java 2 Runtime Environment: Version 1.4.2_05 by Apple Computer, Inc.
Logging to file: /Users/craigmalquist/Desktop/java.txt
apple.awt.EventQueueExceptionHandler Caught Throwable :
java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
   at java.lang.Runtime.loadLibrary0(Runtime.java:788)
   at java.lang.System.loadLibrary(System.java:834)
   at org.lwjgl.Sys.initialize(Sys.java:129)
   at org.lwjgl.Sys.<clinit>(Sys.java:96)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:93)
   at mainmenu.MainMenu.<init>(MainMenu.java:82)
   at mainmenu.MainMenu$2.run(MainMenu.java:335)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
   at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:234)
   at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)


It looks to me like the Mac webstart stuff doesn't accept the java.library.path of "." for getting the libraries out of a jar file.

What would the proper syntax/solution be then?
Title: Mac bug? Or just his machine?
Post by: elias on January 13, 2005, 08:49:13
If it's web start, it has probably something to do with the resources entry:


<resources os="Mac OS X" arch="ppc">
   <j2se version="1.4+"/>
   <nativelib href="native-macosx.jar"/>
</resources>


I'm guessing the os or arch property property is not matching his system. I don't know why though. You can test it by simply removing the properties so it will be used unconditionally. If it works, we just need to find the right combination.

- elias
Title: Mac bug? Or just his machine?
Post by: elias on January 13, 2005, 08:52:36
According to

http://www.vamphq.com/os.html

"Mac OS X" and "ppc" should work just fine. Could you try to print out System.getProperty("os.name") and System.getProperty("os.arch") from his system?

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 13, 2005, 16:52:15
Looks like that did it! Mostly...

He can now load up my JFrame-based start menu (which also uses some lwjgl just for positioning the screen), but he only gets a black window for the OpenGL window (both in fullscreen and windowed mode).
Title: Mac bug? Or just his machine?
Post by: elias on January 13, 2005, 18:20:44
What's his OS version? And what's the value of those properties I mentioned?

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 13, 2005, 19:49:15
I'll get you the info as soon as I can. The guy I usually bother doesn't know much about his Mac, and isn't local, so I can't get too much info from him except if it works or not. The other guy (who's a Mac expert) I only see a couple of times a week.
Title: Mac bug? Or just his machine?
Post by: gregorypierce on January 13, 2005, 21:05:04
I can help you. I have several Apples of various vintiges at home. Send me a private message and I'll help you out. I don't bomb out on any of the puppygames.net files so I can probably identify the problem for you pretty quickly.
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 03:34:48
Here's the output that gregorypierce was kind enough to send me. I'm not quite sure how to handle this one. It could be happening because I call the object from a Swing-based menu (the menu is where I let them setup their display options and the like). It works fine on Windows and Linux however.


Java Web Start 1.4.2_05 Console, started Tue Jan 18 22:20:37 EST 2005
Java 2 Runtime Environment: Version 1.4.2_05 by Apple Computer, Inc.
Java Web Start 1.4.2_05 Console, started Tue Jan 18 22:20:48 EST 2005
Java 2 Runtime Environment: Version 1.4.2_05 by Apple Computer, Inc.
apple.awt.EventQueueExceptionHandler Caught Throwable : java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
at java.awt.EventQueue.invokeAndWait(EventQueue.java:817)
at org.lwjgl.opengl.MacOSXFrame.invokeAWT(MacOSXFrame.java:249)
at org.lwjgl.opengl.MacOSXFrame.syncReshape(MacOSXFrame.java:258)
at org.lwjgl.opengl.MacOSXFrame.<init>(MacOSXFrame.java:87)
at org.lwjgl.opengl.MacOSXDisplay.createWindow(MacOSXDisplay.java:79)
at org.lwjgl.opengl.Display.createWindow(Display.java:206)
at org.lwjgl.opengl.Display.create(Display.java:525)
at org.lwjgl.opengl.Display.create(Display.java:499)
at tools.ScreenManager.<init>(ScreenManager.java:101)
at twister2.Twister2.begin(Twister2.java:145)
at mainmenu.MainMenu.actionPerformed(MainMenu.java:229)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1819)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1872)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:247)
at java.awt.Component.processMouseEvent(Component.java:5166)
at java.awt.Component.processEvent(Component.java:4963)
at java.awt.Container.processEvent(Container.java:1613)
at java.awt.Component.dispatchEventImpl(Component.java:3681)
at java.awt.Container.dispatchEventImpl(Container.java:1671)
at java.awt.Component.dispatchEvent(Component.java:3543)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3527)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3242)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3172)
at java.awt.Container.dispatchEventImpl(Container.java:1657)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3543)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 09:09:18
Fixed (as stated in gregorys thread). Be careful with calling GL from the AWT thread.

- elias
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 09:10:56
Fetch the updated libs here:

http://odense.kollegienet.dk/~naur/lwjgl_19012005.zip

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 13:25:58
QuoteBe careful with calling GL from the AWT thread.

It seems to make sense for creating a "pre-launch" window however (it's much easier on a system to set the resolution, vsync, etc, before the OpenGL window is created). It gets a little tricky when trying to do it "in-game" (you have to reload all your textures for the new resolution when they switch, and destroy/recreate the OpenGL window on the fly). Is there a better way you would recommend?

In the meantime however, THANK YOU for the fix!!!!  :)
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 13:31:38
You don't have to reload textures, just use Display.setFullscreen() and Display.setDisplayMode() (keep the bit depth though).

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 15:20:53
If you switch the displaymode (via setDisplayMode) will it automatically switch for you?

Also, if I understand you correctly, one shouldn't switch the color mode then?
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 16:18:00
BTW, I tried that download link for the updates, but it comes up empty.
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 19:16:54
Yes, you've understood it correctly. The newest link is:

http://odense.kollegienet.dk/~naur/lwjgl_19012005-2.zip

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 19:38:46
I've installed the new libraries... now, on all platforms (Mac, Windows, Linux), the OpenGL window just flashes open and then immediately closes.
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 19:56:05
And then what? Exceptions? Native crashes? Or does the program really just continue with no window open?

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 20:29:51
I've been trying to find out what's going on... I'm not getting any console messages. The java process just sits there as if it's waiting for something.

Maybe I should be a good little programmer and do my menu in-game.  :?:
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 20:34:23
Try sending it a QUIT signal to get it to dump the current threads. It sounds like a deadlock.

Under linux you send it by pressing ctrl-\ in the console)

- elias
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 20:38:11
There are some minor API changes in the new build, so did you re-compile your game with the new lib too or did you just try an existing version with replaced libs?

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 20:48:21
I just swapped out the files actually. Are these going to be changes for the next version official as well? Because it looks like it's the keyboard.enablebuffer call.

Here's the output from the QUIT:


Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.lwjgl.in put.Keyboard.enableBuffer()V
       at tools.ScreenManager.<init>(ScreenManager.java:137)
       at twister2.Twister2.begin(Twister2.java:146)
       at mainmenu.MainMenu.actionPerformed(MainMenu.java:229)
       at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
       at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
       at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
       at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour ce)
       at java.awt.Component.processMouseEvent(Unknown Source)
       at javax.swing.JComponent.processMouseEvent(Unknown Source)
       at java.awt.Component.processEvent(Unknown Source)
       at java.awt.Container.processEvent(Unknown Source)
       at java.awt.Component.dispatchEventImpl(Unknown Source)
       at java.awt.Container.dispatchEventImpl(Unknown Source)
       at java.awt.Component.dispatchEvent(Unknown Source)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
       at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
       at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
       at java.awt.Container.dispatchEventImpl(Unknown Source)
       at java.awt.Window.dispatchEventImpl(Unknown Source)
       at java.awt.Component.dispatchEvent(Unknown Source)
       at java.awt.EventQueue.dispatchEvent(Unknown Source)
       at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
       at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
       at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
       at java.awt.EventDispatchThread.run(Unknown Source)


P.S. I love how I had to use Linux to get the info for you.  :P
Title: Mac bug? Or just his machine?
Post by: elias on January 19, 2005, 20:51:07
Yes. Just remove that call, since it's done automatically for you. Same with the Keyboard.enableTranslation() call (if you use that). To be sure, recompile the whole game against the new lib.

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 21:08:17
It's recompiled, and working now on Windows and Linux. My friend with a Mac isn't available quite yet to try it again. I'll let you know as soon as he shows up.
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 21:39:18
Ok, he tried it. He get's the menu fine, launches the option, which opens the OpenGL window... but the window just stays blank now.  :?

We're closer I guess. At least now the window pops up.
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 19, 2005, 21:51:51
Just for kicks, I set it up to skip the swing menu and launch straight into the game with preset options. It worked. So it is still the launching from a swing menu that's the problem.
Title: Mac bug? Or just his machine?
Post by: elias on January 20, 2005, 09:57:07
Make sure you do a Display.makeCurrent() on the thread you're doing GL from.

- elias
Title: Mac bug? Or just his machine?
Post by: elias4444 on January 20, 2005, 14:56:07
What does makeCurrent() do?

Also, I've noticed with the "in-game" display options, when I change the displaymode, the screen goes completely crazy. I sometimes end up with multiple screens, or the screen flashes to fullscreen, back to windowed. The only way I could find around this was to do a Display.destroy(), and then recreate the window. Is that the right way? Or is there something more elegant?
Title: Mac bug? Or just his machine?
Post by: elias on January 20, 2005, 18:44:08
I think I might know what caused the problem. Could you try this (untested) fixed lib out:

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

- elias