jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.81k stars 1.12k forks source link

Use jMonkeyEngine with an external main loop #1862

Closed wolfgang-ch closed 1 year ago

wolfgang-ch commented 1 year ago

I would like to animated a 3D figure from a gltf model with jME. The 3D figure should be moving along a track on a 2.5D map, like in this video by replacing the moving triangle with a 3d figure.

https://user-images.githubusercontent.com/1283445/200186937-4fae1921-06b0-40d1-bd03-68a821ae1a6c.mp4

This 2.5D map is based on https://github.com/mapsforge/vtm which is running the Lwjgl 2 main loop https://github.com/libgdx/libgdx/blob/9f72b0037cc98da57e783f177d7a993501308680/backends/gdx-backend-lwjgl/src/com/badlogic/gdx/backends/lwjgl/LwjglApplication.java#L122-L138

This would be the pseudo code for the 2.5D map Lwjgl main loop to render also the 3D jME animation:

while (running) { 

   switch OpenGL context to jME

   render animation frame into a 2D texture // performed in jME

   switch OpenGL context to main loop

   render map frame and blend in the animation from the 2D texture
}

Here are my Questions when jME is not running the main loop:

  1. Do jME support such an app layout ?

When 1. is true:

  1. How setup the OpenGL context in jME
  2. How render a single frame in jME

Why do I not use the libgdx framework to implement the animation? A 3D framework animation is very new for me and it looks easier for me to implement it with jME.

pspeed42 commented 1 year ago

It would be 1000x easier just to do everything in JME or everything in libgdx. I predict nothing but difficulties on this path and the amount of time it will take you to get it working could easily have been spent porting the "other half" to the one engine.

Note: this is really a question for the forum where folks might be able to offer advice on approaches and so on. The JME "team" (such as it is these days) is unlikely to implement this "feature" without contribution from (so far) the only person who has ever needed it (you). And only a handful of people read these issues when they get added... where as you might get 50-100 eyes on your problem with a forum post.