LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Kieran on May 02, 2011, 07:53:24

Title: Is LWJGL a good choice for 3D applets?
Post by: Kieran on May 02, 2011, 07:53:24
Hey there, thank you for taking the time to read my thread.

While I understand that LWJGL is good for 3D graphics in Java (or so I've been told), is it a good choice for programming 3D applets for use on the web?

My long term goal is to create a 3D game that can be played in a web browser, and once I get to that stage I may choose to add multiplayer functionality.

If you answer yes, and happen to know of a place I can find resources or tutorials that show how to use LWJGL in applets, I would greatly appreciate a link.

Thank you for your time.
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: kappa on May 02, 2011, 12:55:59
yes, try the LWJGL wiki (http://www.lwjgl.org/wiki/index.php?title=Main_Page).
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: arielsan on May 02, 2011, 14:18:25
Quote from: Kieran on May 02, 2011, 07:53:24
Hey there, thank you for taking the time to read my thread.

While I understand that LWJGL is good for 3D graphics in Java (or so I've been told), is it a good choice for programming 3D applets for use on the web?

My long term goal is to create a 3D game that can be played in a web browser, and once I get to that stage I may choose to add multiplayer functionality.

If you answer yes, and happen to know of a place I can find resources or tutorials that show how to use LWJGL in applets, I would greatly appreciate a link.

Thank you for your time.

One word: Minecraft (http://www.minecraft.net/)

:D

Title: Re: Is LWJGL a good choice for 3D applets?
Post by: Kieran on May 02, 2011, 15:13:27
Thank you both for the replies.

I have decided I will use LWJGL, and I will start when I have some spare time.
Hopefully it won't be too difficult, considering I have programmed in openGL with C++.
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: Kieran on May 02, 2011, 17:03:33
Well I had a look at the space invaders example on the wiki.
I got it to work in both netbeans and eclipse in the applet viewer.

However, when I tried to run it from a browser all I get is an empty screen.
How can I go about running this applet in a browser?

Thank you for your time.
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: kappa on May 02, 2011, 17:13:48
how are you running it in the browser? please post you html code.
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: Kieran on May 02, 2011, 17:18:55
<html>

<body>

<applet code="org.lwjgl.util.applet.AppletLoader"
        archive="lwjgl_util_applet.jar"
        codebase="."
        width="640" height="480">

   <param name="al_title" value="mygame">
   
   <param name="al_main" value="org.example.spaceinvaders.GameApplet">

   <param name="al_jars" value="SpaceInvaders.jar, lwjgl.jar">

   <param name="al_logo" value="appletlogo.png">
   <param name="al_progressbar" value="appletprogress.gif">
   
   <param name="al_windows" value="windows_natives.jar">
   <param name="al_linux" value="linux_natives.jar">
   <param name="al_mac" value="macosx_natives.jar">
   <param name="al_solaris" value="solaris_natives.jar">
</applet>

</body>

</html>
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: kappa on May 02, 2011, 17:27:45
also do you get any exception in the java console? if its not enabled turn it on from the java control panel (on windows you can find the java control panel in the windows control panel then enable the java console from the advanced tab).
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: Kieran on May 02, 2011, 17:34:15
Nope, no errors.

I think it has something to do with the JAR file itself, most likely the resources (images, sounds etc) not being included in the JAR.
I'll try play around and get it to work since I'm new to Eclipse.

Thank you for the help.
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: Kieran on May 05, 2011, 05:44:44
Okay I really need some help. I've been trying for a couple of days to get the space invaders example applet to run in a browser, but I just can't get it to work.
I can run the gears example fine in my browser.
I can run the space invaders example fine in the applet viewer.
When I export the space invaders example to a JAR file, it loads in the browser, but then only fills in the applet with black.
The sounds and images do not load, so I assume it has something to do with the resources but I'm really not sure.

Can anyone explain to me how to get it to work?

In eclipse there is a folder called src with the classes in it.
There is another folder called res which has the resources in it, which is linked via classpath.

I also have the example working in netbeans if anyone only knows how to do it in there.

Basically, I need to know how to export the JAR file and then run it in a web browser.

Your help is greatly appreciated. Thank you.
Title: Re: Is LWJGL a good choice for 3D applets?
Post by: kappa on May 05, 2011, 08:38:28
have you got it uploaded somewhere which you can share here to allow a closer look at it ?