views:

1321

answers:

6

I can't find a clear answer to this question with all my googling.

If I want a web applet, is there a library in Java that takes advantage of the hardware accelerated graphics drivers on the client's machine, as in OpenGL and directx? I'm picturing writing some driver detection code before the applet launches to detect 3D graphics capabilities.

I realize there are a lot of Java 3D libraries but can't figure this out.

I was under the impression that you could do that, but can't find it.

While i'm asking, how about Flash and Silverlight? I thought all their 3D graphics are software rendered?

EDIT:

I see the answer to the question is yes, Java does have 3D hardware support. Thanks for all the info!

I guess my real question is (what I'm getting at):

1) To what extent is this supported for full use? Can you use DirectX or OpenGL shaders, for example? I might expect some features to be missing as that tend to abstract things out. Could I make a GPUID program or a utility that list's the client's GPU capabilities in detail?

2) Is it practical? Could I port an old 3D game like Quake to a Java applet and have decent performance? (depends on client system of course)

A: 

Support for hardware accelerated graphics has been in Java since 1.5.

See the release notes on how to do it. Note: this is for 2D.

For 3D, J2SE has Java3D.

Ben S
+2  A: 

The applet-launcher project should help:

The JNLPAppletLauncher is a general purpose JNLP-based applet launcher class for deploying applets that use extension libraries containing native code. It allows applets to use extensions like Java 3D, JOGL, and JOAL very easily, with just a few additional parameters to the <applet> tag, on Java SE versions as far back as 1.4.2.

JOGL has a sample applet here, and Java3D has two samples here.

Michael Myers
the first link you gave me locked up safari on my non-intel based mac. So much for high compatibility!
tkotitan
There is also a version JOGL in JavaFX.tkotitan: Did you get a stack dump?
Tom Hawtin - tackline
The applet launcher itself? Or the JOGL one? Anything OpenGL kills my computer (I have integrated ATI video).
Michael Myers
Are you running Linux? OpenGL and hence JOGL support is notoriously patchy under Linux.
DJClayworth
@DJClayworth: No, I'm running Windows XP SP3. And I don't have an admin account, so I can't update my drivers (which I suspect are the issue).
Michael Myers
A: 

Flash supports pseudo-3D, but not any kind of OpenGL accelerated full-scene 3D (basically just perspective warping effects). There are some software oriented solutions as well (eg, Papervision3D).

Silverlight will support pseudo-3D as well with the 3.0 release later this year. As far as I know, there are currently no plans for full 3D there.

Supposedly 3D support is planned for a later release of the JavaFX initiative, which would (if it ever happens) improve support in applets quite a bit.

jsight
A: 

DirectX is a proprietary Microsoft 3D system, so unless you are sure you will only run on Microsoft systems I would avoid DirectX.

JOGL and Java3D are very different. JOGL is a thin layer over OpenGL, with all the advantages and disadvantages that implies. Java3D is a full scenegraph system.

DJClayworth
A: 

It also may be useful to note that in the new versions of Java (I think 1.6 release 10?) there were significant improvements to the graphics pipeline for windows.

James Van Boxtel
A: 

You won't have shaders, last I checked; you get basically a scenegraph API on top of what you might consider to be DX5 or DX6 level functionality, depending on what you're doing.

M1EK