在 Java 应用程序中与 Ogre(C++) 交互的最佳方式是什么?

发布于 2024-12-27 20:28:00 字数 377 浏览 1 评论 0原文

我有一个 Java 应用程序,想在其中连接 Ogre。 具体来说,Ogre 是一个 3D 游戏引擎库,里面有大量复杂的 C++ 对象。我有多种选择来完成此任务

1.)使用原始 JNI(因为 JNI 相当复杂)

2.)使用 SWIG + JNI(有点简单) ...但仍然涉及到JNI)

3.)使用Lua而不是JNI(使用lua绑定到Ogre)...基本上使用Lua有帮助,因为C++库与Lua的接口更加容易并且调用Lua来自java不会太难。

4.)使用Ogre4j(使用JNI的Java绑定到Ogre...但是这个项目没有用最新的Ogre版本更新)

考虑到Ogre的未来维护/升级,其中哪一个/看起来是最好的选择?

选项 3 值得尝试吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

话少情深 2025-01-03 20:28:00

我想建议第五个选项:JNA https://github.com/twall/jna,以前的 java.net 项目。

我的推理:选项 1 和 2 级别太低,选项 3 是实验性的(你提到“大量复杂的 C++ 对象”),选项 4 肯定缺乏更新。 JNA 仍然得到维护、开源(LGPL)、文档化和跨平台(尽管文档/示例可能表明相反)。

更新:
我听说过第六种选择,即“受 JNA 启发”:BridJ http://code.google.com/p/bridj/常见问题解答Wiki 很好地解释了差异及其背后的原因。 BridJ 是活跃且开源的(BSD 和 Apache 许可证)。

I'd like to suggest a 5th option: JNA https://github.com/twall/jna, a former java.net 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).

Update:
I've heared about a 6th option, which is "inspired by JNA": BridJ http://code.google.com/p/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).

走过海棠暮 2025-01-03 20:28:00

也许我们可以使用 XBiG 来生成 Java 代码,就像 ogre4j 那样。实际上,XBiG 源代码有一个生成 ogre4j 源代码的测试,它就是为了完成这项工作而设计的。

Maybe we can use the XBiG to generate the Java Code, just like ogre4j do. Actually, XBiG source code has a test for generate ogre4j source code, and it's designed to do that work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文