File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Game Development and the fly likes Best 3D option in an applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Best 3D option in an applet?" Watch "Best 3D option in an applet?" New topic

Best 3D option in an applet?

David Gibson

Joined: Jan 08, 2004
Posts: 24
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

check out for the most addictive java game ever!!
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

gah -- I suck! That woulc be interesting to have that 3d... although I'm sure I'd be even worse at it.

so, I don't know the answer to your question... so that means I turn to google to find out what I can .

I found this 3d webapp:
downloaded the class file and decompiled it to see what kind of package it uses... and all it imported was this:
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*
import java.util.StringTokenizer;

This one looks pretty cool too, and all its importing is java.awt:
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??

If youc an read spanish -- this seems to be a 3D applet tutorial -->

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 ]

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

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.
David Gibson

Joined: Jan 08, 2004
Posts: 24
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
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

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 ]

GenRocket - Experts at Building Test Data
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

Originally posted by Gregg Bolinger:
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!

still cool though
Phil Proudman

Joined: Nov 29, 2004
Posts: 1

I've been developping an open source 3d applet that you might want to take a look at.

Quick3dApplet page
Download page at sourceforge

It can load 3ds files.

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.
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342

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.

SCJP 1.4,
I agree. Here's the link:
subject: Best 3D option in an applet?
It's not a secret anymore!