Is DirectX on Java possible?
Asked Answered
D

7

13

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.

Dorcus answered 3/5, 2009 at 14:33 Comment(0)
H
4

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.

Houser answered 8/5, 2009 at 14:51 Comment(0)
E
3

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.

Expostulate answered 3/5, 2009 at 14:37 Comment(3)
I believe Java3D is powered by OpenGLSpendable
It supports both OpenGL and DirectX: j3d-core.dev.java.net/j3d1_5_2/RELEASE-NOTES.htmlApparel
Still though, that is only 3D and I was mainly interested in the Video API.Dorcus
O
3

I create a library using BridJ (https://bridj.googlecode.com) that wrap DirectX classes, so you can use almost the same code than C++ examples.

You can find the library in https://bitbucket.org/fourthskyinteractive/directx-for-java.

Please, let me know about projects you develop.

Osber answered 14/6, 2013 at 16:48 Comment(0)
S
2

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.

Softhearted answered 3/5, 2009 at 14:48 Comment(1)
Sorry but it was the video API I was interested in, not the 3D API.Dorcus
D
1

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

Devereux answered 8/5, 2009 at 16:4 Comment(2)
Unfortunately there are some things DirectVideo can do that JMF cannot, which is a bit of a pain.Dorcus
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.Mensa
C
1

Minecraft is coded in Java with LWJGL, but Messiah Andrew's Renderer Wrapper converts the OpenGL to DirectX by using a modified version of the LWJGL libraries. Using these libraries, you should be able to code in LWJGL and have the game be running DirectX.

Carman answered 18/1, 2014 at 16:36 Comment(0)
K
1

It seems that most are forgetting that JavaFX and Java3D support both DirectX and OpenGL using the best context for the machine you are on... well actually if you are on windows it attempts to load DirectX if it is newer than your OpenGL version.

I am not telling anyone to use either Java3D or JavaFX, but if you look at the source you can see how it is done.

GrepCode "good for looking for how things are implemented"

Open JavaFX "Open JavaFX project home" source

I should note that you want to look at the com.sun.prism package.

Java3D "Java3D project home" sources

I have been LEARNING development, LOL, for 20 years. Professionally for about 8 possible has never been the question, but how long, and/or is it worth it... Those are the questions.

Good luck my friend!

If you need any help I would be interested in creating a DirectX wrapper for java so

GIVE ME A SHOUT!

Kilmer answered 12/7, 2016 at 14:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.