Creating a DirectX binding

Started by Matzon, July 09, 2007, 16:17:31

Previous topic - Next topic

Matzon

There have been some discussions about creating a DirectX binding for LWJGL on JGO, see this thread:
http://www.javagaming.org/forums/index.php?topic=16985

CaptainJester mentioned that he was already working on this.

LWJGL will be happy to donate to the project, and I encourage people to discuss this some more and help CaptainJester.
We can also provide SVN access.

Naturally there will be some integration work, that we will have to tackle - and this will be a win32 only binding (sans wine). However some people have talked about doing an OGL wrapper on top.

CaptainJester

Hopefully I will have something preliminary to show in a couple of weeks.  Maybe just getting a triangle on the screen.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

princec

Would like to explain to everyone that writing an OGL->Direct3D wrapper is really, really, really f*cking difficult :) SciTech basically couldn't manage it and they're pretty much experts. Well, they did one, but it was far from reliable.

Cas :)

elias4444

I would definitely stay clear of an OGL -> D3D wrapper... I don't think it's worth the immense amount of work.

Would it be better to create a separate project (apart from LWJGL) for a D3D binding? I'm worried that by including D3D alongside the OGL bindings you might introduce platform inconsistencies throughout the project.

Is there some benefit of including D3D that I'm missing? I know Vista has had some issues with OGL, but they seem to be clearing up slowly, but surely.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

Matzon

I dont expect many issues with supporting both opengl and directx with a similar Display. As for packaging and distribution we might want to split it up into lwjgl_ogl.jar / lwjgl_dx.jar or something like that - but lets worry about that further down the line.

The main benefit of having dx support is basically much better driver support on the primary win32 platform. Supporting dx on linux/mac could perhaps be done using wine - but I am very unsure about that.

erikd

Quote from: elias4444 on July 11, 2007, 17:40:16
I would definitely stay clear of an OGL -> D3D wrapper... I don't think it's worth the immense amount of work.

Yes, the more I think about it, the less it makes sense. Apart from being difficult, it would never be the optimal solution. It's probably better to use a D3D binding in higher level libs like Slick and jME.

Nero

Quote from: Matzon on July 11, 2007, 18:14:39
As for packaging and distribution we might want to split it up into lwjgl_ogl.jar / lwjgl_dx.jar or something like that - but lets worry about that further down the line.
I think this will probably the best solution to avoid any performance issues.

We should remember that people needs to upgrade their drivers to have good performance with OpenGL in Windows Vista. MS drivers only supports emulated OpenGL with DirectX. Average Joe probably won´t go to their video card website and get the lastest driver.


Evil-Devil

I think there should be no OGL -> D3D -> OGL Wrapper. Distribute both APIs as single packages and let the programmer handle how they like to use it. It is like writing an engine for LWJGL and JOGL (i never did, but some ppl i know did), setting up base abstract classes and doing the final stuff in specialiced classes. Thats the way I'd like to go with DX to, if I would use it in any project besides OGL.

publicminx

hello folx ;)

i detected some times ago a nice java-direct3d wrapper ...

link: http://sourceforge.net/projects/java-direct3d

supports directx 9/direct3d and 64 bit (!) ...
sources (c++) are availiable ...
appears not to be under further development ;(

anyway: the result (in some quick/dirty tests) were: between twice and more times as fast as LWJGL ...
or better: this will most likely the case for most ATI/Catalyst users ... like me (i have a 4830 card)

the reason for that is the bad OpenGL implementation of AMDs/ATIs Catalyst Drivers ...
you can see that in "everyone-realworld-applications" like SecondLife, Ogre, ActiveWorlds and/or generally if you test Software which offers both: Directx/Direct3D and OpenGL or test on the same/similar systems with different Graphic cards ...

a nice Example is also this Engine/Demo: http://unigine.com/download/
(let you benchmark OpenGL, different Direct3D versions)

general: for ATI/Catalyst/OpenGL the most likely result is:
- Nvidia/Geforce is usually about twice as fast as ATI/Catalyst (or much much more in some situations)
- ATI/Catalyst Direct3D is about twice as fast asa ATI/Catalyst OpenGL (or much much more in some situations)

this also means: Ogre/Java (there is a binding) and Direct3D beats by far everything you can do with LWJGL/JMonkey in performance for ATI/Catalyst cards ...
because of the bad OpenGL Permance (extraordinary bad, not the typically result of the "more focus of the industry on Direct3d"!)

The main problems with the Catalyst OpenGL implementation seems to be in the Texture (Mem) Handling not in GPU-related stuff ...

In most typical "patched" Gamebenches or Synthetic Tests you cannot see that, because they run only with Opengl or Direct3d or tests statically stuf which has not much to do with what i call "Everyones Realworld Stuff" like SDL, SFML, Ogre, JWJGL, Jogl, JMonkey, Irrlicht, Second Life, all that OpenSim stories and so on and so on ...
all of them have to handle usually much more flexible structures, general texture handling etc.

so, Direct3D would make sense for much more concrete reasons...

(but please no odd name like "LWJGL" as base... better to rename both. show ppl the LWJGL page and talk about what it does and later ask them how the name was then you know what i mean)


bobjob

Ok, Im sorry I really couldnt help myself.  :P


Quote from: publicminx on April 11, 2009, 11:07:30
hello folx ;)
hi

Quote
i detected some times ago a nice java-direct3d wrapper ...
link: http://sourceforge.net/projects/java-direct3d
congrats!

Quote
general: for ATI/Catalyst/OpenGL the most likely result is:
- Nvidia/Geforce is usually about twice as fast as ATI/Catalyst (or much much more in some situations)
- ATI/Catalyst Direct3D is about twice as fast asa ATI/Catalyst OpenGL (or much much more in some situations)
thanx for the official stats.

Quote
(but please no odd name like "LWJGL" as base... better to rename both. show ppl the LWJGL page and talk about what it does and later ask them how the name was then you know what i mean)
sure thing boss.

Evil-Devil

Since when does the GL in LWJGL stands for (Open GL)? :D
Anyway, a feasible D3D binding would be cool, tho the overhead for any recent lwjgl/jogl based engine.

@

Sorry if i'm misposting, but i'm curious: What happened with this? Does exist a way to use directx with java? Are there any plans for including a wrapper on lwjgl 3 ?