views:

3064

answers:

4

Is there an easy way to use DirectX in Java? In particular, DirectX's video APIs.

I know that C# might be a more natural choice, but I have my devious reasons for wanting to do something so perverse.

A: 

There seems to be a standard API about dealing with 3D inside Java.

It probably uses some kind of accelerating technology, may be even DirectX.

But I'm not sure about direct video support in this framework.

Vitaly Polonetsky
I believe Java3D is powered by OpenGL
Richie_W
It supports both OpenGL and DirectX: https://j3d-core.dev.java.net/j3d1_5_2/RELEASE-NOTES.html
McDowell
Still though, that is only 3D and I was mainly interested in the Video API.
izb
A: 

There is a set of Direct3D bindings for Java available at http://java-direct3d.sourceforge.net/ but it seems that developement stopped in 2006 with DirectX 9.

Otherwise, there are OpenGL binding for java called JOGL.

LordOfThePigs
Sorry but it was the video API I was interested in, not the 3D API.
izb
+2  A: 

I don't know about easy, but you could always use JNI to load the DirectX libs and invoke the methods.

Using something like Swig you could auto-generate a lot of the code.

Not sure how workable something like that would be though.

Glen
A: 

The package that you want to investigate is the Java Media Framework (JMF). The core of it is pure Java, and per-platform "performance packs" provide acceleration via native libraries. It currently supports A/V capture and playback in a wide variety of data types as well as streaming via RTP and RTSP.

Sun's JMF home page

JMF SW/HW requirements

Devon_C_Miller
Unfortunately there are some things DirectVideo can do that JMF cannot, which is a bit of a pain.
izb
Also, JMF hasn't been updated since the Stone Ages. A better thing to check out right now would be JavaFX, which presents some integration challenges but actually has newish code behind it.
M1EK