www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: fireside on July 25, 2008, 07:36:11 am

Title: Converting Hello World to Applet
Post by: fireside on July 25, 2008, 07:36:11 am
I finally got a little applet running on my free website.  The next thing I'd like to do is convert the helloworld jpct software example to an applet.  Would I just drop the main function and use the init for that?
Title: Re: Converting Hello World to Applet
Post by: Melssj5 on July 25, 2008, 04:05:41 pm
No, some things have to be changed, for example the arguments of the methods to load the 3d model and the textures. You have to use the docbase to load things in jopct from an applet. If you want to render in opengl from an applet, the the client machine needs to have the dll from lwjgl.
Title: Re: Converting Hello World to Applet
Post by: EgonOlsen on July 25, 2008, 05:28:00 pm
And you have to spawn an extra thread that executes the game loop. Just any other applet that does active rendering does. Prsonally, i would just let the init-method spawn the thread and do the setup work plus the game loop in the thread.
Title: Re: Converting Hello World to Applet
Post by: fireside on July 25, 2008, 06:10:12 pm
I don't suppose anyone has a small example of a software applet they could let me see. 
Title: Re: Converting Hello World to Applet
Post by: EgonOlsen on July 25, 2008, 08:53:09 pm
In the download directory (http://www.jpct.net/download (http://www.jpct.net/download)), there's still an year old version (0.96) which was the last one, that came with an applet example. It does a lot of things terribly wrong (like the timing and such), but it may work as a starting point. Just don't take everything too serious that you see in the code. If it looks strange, it's most likely wrong...like doing the game logic in another thread... :P
Title: Re: Converting Hello World to Applet
Post by: fireside on July 25, 2008, 11:03:53 pm
O.K.  Thanks.  I found a java game applet tutorial so between the two maybe I can figure it out.
Title: Re: Converting Hello World to Applet
Post by: paulscode on July 26, 2008, 05:51:25 pm
I wrote some threads a while back when I first started out using applets.  You might find them helpful:

A really basic one:
http://www.jpct.net/forum2/index.php/topic,1031.msg6376.html#msg6376

And this thread goes a little more in depth:
http://www.jpct.net/forum2/index.php/topic,1032.msg6431.html#msg6431

If you need any more explanations about the above threads and code, or help with using the appletloader (for hardware-rendering mode), let me know.
Title: Re: Converting Hello World to Applet
Post by: fireside on July 27, 2008, 01:04:13 pm
Thanks.  I didn't know you put up any software rendering code.  I'm getting closer.  Part of it is figuring out how Netbeans works and the tags and what not.  I have it reading a file now, but not displaying.  I'm getting closer, anyway. 
Title: Re: Converting Hello World to Applet
Post by: raft on July 27, 2008, 10:45:00 pm
as posted in some other thread, here is another running applet sample. the main difference is i do the rendering in awt thread which makes using swing/awt components much easier IMHO.

http://www.aptalkarga.com/download/SwApplet.java