www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Tornado7 on May 10, 2004, 04:36:53 pm

Title: Switching renderer in an applet context
Post by: Tornado7 on May 10, 2004, 04:36:53 pm
Hi,

Is possible to use the fpss switching renderer option in a applet context? If its so, in which way I can fit the dos command line:

java -Djava.library.path=..\..\lib\lwjgl-0.8\ -cp ..\..\lib\lwjgl-0.8\lwjgl.jar;fps.jar -Xmx100000000 JPCTDemo

into the html code that loads the applet?

Bye and thanks for any answers
 :)
Title: Switching renderer in an applet context
Post by: EgonOlsen on May 10, 2004, 05:06:15 pm
Short answer: I don't know. I never tried it. Even if it is possible somehow to make the applet access the LJWGL-DLL, this would limit your applet to Windows and you would have to sign it.
I suggest to use Webstart instead. It's easy to work with and you can make sure that every OS gets the correct native libs.
Title: Switching renderer in an applet context
Post by: Anonymous on May 10, 2004, 06:14:41 pm
Sorry for ignorance  :oops: .... But, what is Webstart
Title: Switching renderer in an applet context
Post by: EgonOlsen on May 10, 2004, 06:25:54 pm
Webstart is SUN's "replacement" for applets (since Java 1.2.2 or so), i.e. a way to distribute and launch applications via a network. I made some small webstart demos using jPCT. They can be found here (you need at least Java 1.3 to run them):

http://www.jpct.net/forum/viewtopic.php?t=134

All you do is to write a small XML-file that tells Java webstart what to download and what to start. I can give you a sample XML if you are interested.
Title: Switching renderer in an applet context
Post by: Tornado7 on May 10, 2004, 07:05:16 pm
Thank you very much for your help.... I'd have two another little questions; If I decide to use only sw renderer I'll have not, in theory, any compatibility problem?

I've a problem mapping keys to event.... In fps example, using the following code:

case (KeyEvent.VK_X): { // change renderer  (x)
            if (event) {
               switchMode=35;
            }
         break;
}

you've mapped the x small key to the "event" changing renderer; I've use a similar code to use the q small key to rotate the camera in my applet, but, running the applet, it only works if use the capital q (Q) and I don't understand why......

Bye and thanks again
Title: Switching renderer in an applet context
Post by: EgonOlsen on May 10, 2004, 07:14:14 pm
No, hardware and software renderer can both do the same things. Software is just slower and doesn't look as good as hardware. But it will run everywhere, where Java1.1 is installed (including IE or NS4.7).
If you are using applets, maybe the old applet example is of interest for you. I've removed it from the distribution because it was outdated and ugly, but it's still available in this package (it's called bounce): http://www.jpct.net/download/jpctapi_096.zip
It should include some keyboard related stuff for applets. Please use just the example from this package, not the whole api.
Title: Switching renderer in an applet context
Post by: Anonymous on May 10, 2004, 07:47:15 pm
Thanks  :)
Title: Switching renderer in an applet context
Post by: Bart on May 11, 2004, 06:28:55 pm
I have searched information about using native code in applets some time ago but i didn't find much information about it. The FAQ of the LWJGL site tells that it isn't possible to use LWJGL from an applet.

Quote
Q: Is it possible to use LWJGL from an Applet?
A: Unfortunately, no. However you can start a LWJGL application from a webpage using Java WebStart. For more information click here
Title: Switching renderer in an applet context
Post by: EgonOlsen on May 11, 2004, 11:40:55 pm
Well, it's of course impossible to render directly into the applet, but i thought that it may be possible to open the LWJGL-window from within the applet. Anyway, a system that could probably do that can do webstart as well... :wink: