seahorse seahorse - 1 year ago 75
C++ Question

What is the best Way for Interfacing with Ogre(C++) in a Java Application?

I have a Java Application and want to interface Ogre inside it.
Specifically Ogre is a 3D Game engine library which has plenty of complex C++ objects inside it.I have got multiple options to accomplish this

1.)Use Raw JNI (Tough as JNI is quite complex)

2.)Use SWIG + JNI (Somewhat simple...but still JNI is involved)

3.)Use Lua and NO JNI (Use lua binding to Ogre)...Basically using Lua helps because interfacing a C++ lib with Lua is much more easier and calling Lua from java wouldnt be too hard.

4.)Use Ogre4j (A Java binding to Ogre using JNI...but this project isnt so updated with the latest Ogre version)

Which of these/looks like the best option keeping in mind future maintenance/upgrades to Ogre?

Is Option no 3 worthwhile for trying out?

Answer Source

I'd like to suggest a 5th option: JNA, a former project.

My reasoning: options 1 and 2 are too low level, 3 is imho experimental (you mentioned "plenty of complex C++ objects"), and number 4 definitely lacks updates. JNA is still maintained, open source (LGPL), documented and cross-platform (although the docs/examples might suggest opposite).

I've heared about a 6th option, which is "inspired by JNA": BridJ The FAQ and the Wiki explain well the differences and the reasoning behind it. BridJ is active and open source ( BSD and Apache licence).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download