This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Guys Out of curiosity what would be the best way for me to display 3d graphics in an applet? I fancy trying to make a game that can be run in an applet, similar to the java slime volleyball game but in 3d. Applet is a must though as I want the user to be able to run it in a browser
This one looks pretty cool too, and all its importing is java.awt: http://www.houseof3d.com/pete/applets/graph/ and the guy seems to be doing an ongoing project with it (not sure how active or recent) but he may be willing to discuss his stuff, maybe you can contact him and invite him to our snazzy little forum??
I decompiled a few other classes and the all seemed to be only importing java.awt.* -- so either the decompiler isn't getting everything or all that these guys are using is just java.awt! [ August 11, 2004: Message edited by: Jessica Sant ]
As far as applets go, usually they do software 3D rendering using just the draw functions in AWT. This is for multiple reasons. First, there is the problem with including a third party library with your applet. That means if you used something like Java3D, JOGL, LWGL, etc. to provide hardware accelerated 3D you would have to have the user download that library with your applet every time. Or have the user do some special setup on their side to make sure the 3D library was on the classpath and that the JVM in their browser made use of that classpath. Also, I'm not completely certain that this is the case, but since a hardware accelerated 3D library would have to make use of system calls, I would also think that an applet making use of one of these would need to be signed.
If you're not stuck on the idea of making this an applet, most of these problems go away... you could always make it an application and use Java Web Start to provide a way to download and launch it.
As far as doing software rendering, I have several older books that cover this topic. Two of the better ones were "KickAss Java" by Tonny Espeset (which shows how to do all kinds of cool image filtering effects, 3D effects, spinning menus, etc. and it is focused on applets) and "Graphics Programming with JFC" by David Wall and Arthur Griffith (which is a misleading title - really all it covers is Graphics2D, and all the examples use AWT - but there is a section that shows how to do software rendered 3D ). From what I remember, "Black Art of Java Game Programming" had some good coverage of 2D game programming, but the software rendered 3D section wasn't that good... it made use of one of the author's libraries supplied with the book, and didn't really tell you much about how to do it yourself. I'm not sure if any are in print any longer, but you might be able to pick them up used from somewhere.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Jan 08, 2004
Thanks for your answers Guys I was hoping that there was a library that I could use that could import *.3ds files and then display them in an applet. Looks like the technology isn't there as yet. Maybe in a few years time eh
I would also, like Nate, recommend using Java Web Start. I started writing a little test app using JOGL. You can test it out here. You will need Java 1.5 to run it. But all the DLL's and JAR files for JOGL get loaded to you from my server.
The only thing that it does right now is if you click on the Transform tab and then click the Object button, you can spin the piramid around. Whoopy! [ August 12, 2004: Message edited by: Gregg Bolinger ]
It uses a software renderer, for the reasons that Nathan pointed out. I am hoping that it might be possible, however, for my applet to detect whether Java3d is installed and accessible - and if so switch from the software renderer to use Java3d. I'll be looking into this in the future, but first I have some other ideas for improving the speed of rendering large scenes.
I have worked on a 3D applet to display data using Java3D. There are lots of issues, like needing Java3D installed on the client etc, we can only use it because it is an internal application so we can support it...I wouldn't like to try using Java3D generally on the web.