Hello Guest

[FIXED] Mac OS Java Update 2 ( 1.6.0_20) breaks LWJGL applets

  • 25 Replies
  • 33820 Views
*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #15 on: September 19, 2010, 07:58:17 »
How to use:

create the custom canvas
Code: [Select]
canvas = new ResizableCanvas();


init the canvas after Display.create();
Code: [Select]
Display.create();
canvas.init();

make sure to call doMacFix after update
Code: [Select]
Display.update();
canvas.doMacFix();

also to prevent any errors, make sure to call destroy before Display.destroy();
Code: [Select]
canvas.destroy();
Display.destroy();
optionally: to check if the fix is needed. you could also use this to force a Display window, instead of an applet.
Code: [Select]
canvas.requireMacFix();

The other methods included I use in order to handle my applet on resize.


Some problems:
* You will notice alot of stuff ups when the applet tries to grab the mouse, do this by pressing the esc key on the main menu, or seletecting the close menu button.
* In safari mouse movements only seem to regester if mouse key is down.

Edit: And can someone pleeeeease tell me a accurate way to determine which plugin version is running, thanx.
« Last Edit: September 19, 2010, 17:15:42 by bobjob »

*

Offline kappa

  • *****
  • 1316
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #16 on: September 19, 2010, 09:28:23 »
oh, really cool stuff, if you manage to find a fix/workaround for this problem then your a genius :)

Edit: And can someone pleeeeease tell me a accurate way to determine which plugin version is running, thanx.

I haven't got a mac so not really got anyway to try this, but I am aware that the DeployJava.js has a method that can detect through javascript if plugin2 is running 'isPlugin2()'. Human readable version of the script is found here. Hopefully this'll allow you to find a java method to detect plugin2.
« Last Edit: September 19, 2010, 09:30:25 by kappa »

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #17 on: September 19, 2010, 09:44:25 »
oh, really cool stuff, if you manage to find a fix/workaround for this problem then your a genius :)
This isnt a long term viable solution as it has a incredible slow frame rate, but displaying something is infinetly more than nothing.

Quote
I haven't got a mac so not really got anyway to try this, but I am aware that the DeployJava.js has a method that can detect through javascript if plugin2 is running 'isPlugin2()'. Human readable version of the script is found here. Hopefully this'll allow you to find a java method to detect plugin2.
I will look into it, I might print out the complete list of properties in both versions and see if i can find some useful variations.

Also keyboard seems to be working fine.
So If anyone only uses keyboard in there applets, in that instance this fix should be enough.

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #18 on: September 19, 2010, 09:56:59 »
Some other strange behaviour that I cant seem to fix, Safari Mouse events seem to work fine if the java console (???) has focus.

*

Offline kappa

  • *****
  • 1316
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #19 on: September 19, 2010, 10:06:16 »
This isnt a long term viable solution as it has a incredible slow frame rate, but displaying something is infinetly more than nothing.

Another thing you could do is just not use Display.setParent() if plugin2 is detected on mac, that way when the applet is run you'll just get a popup LWJGL window. Think that should workround the applet offscreen rendering thing and just work at normal speed.

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #20 on: September 19, 2010, 10:14:49 »
Another thing you could do is just not use Display.setParent() if plugin2 is detected on mac, that way when the applet is run you'll just get a popup LWJGL window. Think that should workround the applet offscreen rendering thing and just work at normal speed.
yeah thats definetly the best solution for performance.

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #21 on: September 19, 2010, 10:39:30 »
Ok for those interest I think the Property to find out if your running plugin2 on mac is "java.rmi.server.RMIClassLoaderSpi"

if the value is not null && contains plugin2, then it should be enough to detect that plugin2 is running

Property check applet: have2chat.net/fvf/prop_test.html


Edit:
Updated the source code.
- Safari.
sadly the Mouse functions normally only (aswell as setGrabbed()) as long as the java console has focus.
- Chrome
Mouse.setGrabbed(true) causes errors.

I Think I will leave it there. I'v done the most that I can without going through the LWJGL source code.
Now Im off to watch the first two episodes of Vampire Diaries season 2 JOY!
« Last Edit: September 19, 2010, 11:30:40 by bobjob »

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #22 on: September 19, 2010, 12:42:14 »
one other thing I was thinking, with the new plugin its possible to use JNLP, for cache and such.
Is it possible to pass vm_arguments?

If so then would it be possible to pass an arguement not to render to an offscreen buffer?

if I dont get a response Ill look into it, will fiddle around on it tomorow night.

Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #23 on: September 19, 2010, 13:01:03 »
Another thing you could do is just not use Display.setParent() if plugin2 is detected on mac, that way when the applet is run you'll just get a popup LWJGL window. Think that should workround the applet offscreen rendering thing and just work at normal speed.

Ok for those interest I think the Property to find out if your running plugin2 on mac is "java.rmi.server.RMIClassLoaderSpi"

if the value is not null && contains plugin2, then it should be enough to detect that plugin2 is running

Thanks for the suggestions :)
The detection see to be fine, I have "java.rmi.server.RMIClassLoaderSpi:: sun.plugin2.applet.JNLP2RMIClassLoaderSpi" with plugin2

I think I'll go this way if plugin2 takes too much time to be fixed (I don't think that Apple is very reactive).

*

Offline bobjob

  • ****
  • 394
  • LWJGL: WOW SO GOOD
Re: Mac OS Java Update 2 ( 1.6.0_20) breaks JLWGL applets
« Reply #24 on: September 23, 2010, 07:14:30 »
Hey guys I made a class that will run the canvas in a window if the new plugin is detected.
its attached to this post.

as before, test case: have2chat.net/fvf
Keys 1, 2 switch between display types

This will help you if you dont have access to a Mac, and would like to run LWJGL but cant debug it.

Usage:
instead of creating a new Canvas().
use:
Code: [Select]
rContainer = new ResizableContainer(false);
Canvas canvas = rContainer.getCanvas();
the boolean variable in the ResizableContainer constructor is if you will
be using resizable applets (set your applet size in percentage) then set it true.


setup your canvas as usual (as if it was to run in an applet) before attaching the display,
but instead of using Display.setPerant(...);
use:
Code: [Select]
rContainer.attachDisplay();

and once every game cycle call this method
Code: [Select]
rContainer.checkResize()
you may notice that checkResize() returns a boolean value, I use this to
reset the GL viewport if needed.
you probably wont need the return value if you dont use resizable applets.



Other useful methods.
in order to get the current width and height use:
Code: [Select]
Canvas canvas = rContainer.getCanvas();
if (canvas != null) {
   canvas.getWidth();
   canvas.getHeight();
}
if the canvas is "null" then you will need to get the current DisplayMode, as it means you are running in fullscreen mode.


to set canvas screen mode if possible:
Code: [Select]
rContainer.setFullscreen(null); //SWITCH BETWEEN FULLSCREEN / APPLET
rContainer.setWindow(); //SWITCH BETWEEN WINDOW / APPLET

*note that this wont be the final version, as soon as a opengl supported mac update is released so will this class.

*

Offline kappa

  • *****
  • 1316
Re: [RFE] Mac OS Java Update 2 ( 1.6.0_20) breaks LWJGL applets
« Reply #25 on: September 03, 2011, 16:21:02 »
This issue should now be fixed in latest nightly builds of LWJGL, see this thread for me info.