将 LWJGL java 应用程序放入 jpanel 或 canvas

Put a LWJGL java app in a jpanel or canvas

随着 lwjgl 3 的新更新,class 显示不存在,我到处搜索但找不到任何关于如何将我所有的 lwjgl 应用程序放在 jpanel 或 canvas 或类似的东西。我已经考虑过使用像 twl 这样的 opengl gui,但这会让一切变得更加困难,我不需要它,所以我的问题是如何将 lwjgl 应用程序放在 jpanel 或 canvas 中。 谢谢,它会救我的命。

遗憾的是,目前不支持将 LWJGL3 与 Swing 一起使用。对更多窗口系统的支持在路线图中,但尚不清楚是否会实现。

来自roadmap

Multiple windowing system implementations.

  • [✓] GLFW
  • LWJGL 2 compatible
  • [?] AWT/Canvas
  • [?][.x] JavaFX

One lesson learned from LWJGL 2 is that it's very hard for a windowing system to keep everyone happy. There was always that one feature missing. For 3, the plan is to support a few different windowing system back-ends and possibly an "official" API similar to the current one, with an unspecified implementation under the hood. This might sound like too important a part of LWJGL to be so open, but the fact is that the API surface is quite small. Even with no abstraction layers, it's easy to move client code from one windowing system to another. Forcing a cross-platform and implementation-agnostic API to our users will soon hit us with the same issues we have in LWJGL 2. The only complete implementation we have for now, GLFW, is feature-packed and robust, but it's still early to commit to it. The plan is to explore many different options first and expose everything to users. They always know better.


[?]: Still under discussion. May change or is controversial and may not be implemented at all.