tkotitan
tkotitan

Reputation: 3009

Java applets with hardware accelerated 3D graphics? OpenGL and/orDirectX

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)

Upvotes: 4

Views: 6495

Answers (7)

Jay
Jay

Reputation: 11

It is totally possible to write java applets that access the 3D hardware. The env3d project (http://env3d.org) is exactly that -- a java 3D engine that produces 3D accelerated 3D applets. There are lots of example programs on the website to demonstrate the use of hardware accelerated 3D inside your browser. The only requirement is that Java has to be installed and the user has to explicitly allow the applet permission to access local resources.

Env3D is based on lwjgl, a opengl/gaming wrapper for Java. It even supports shaders and other advanced features.

Upvotes: 1

M1EK
M1EK

Reputation: 820

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.

Upvotes: 0

James Van Boxtel
James Van Boxtel

Reputation: 2415

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.

Upvotes: 0

DJClayworth
DJClayworth

Reputation: 26856

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.

Upvotes: 2

jsight
jsight

Reputation: 28409

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.

Upvotes: 0

Michael Myers
Michael Myers

Reputation: 191895

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.

Upvotes: 3

Ben S
Ben S

Reputation: 69342

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.

Upvotes: 0

Related Questions