eclipse-efx / efxclipse-drift

Eclipse Public License 2.0
147 stars 17 forks source link

Any plans to support active 3D Stereo rendering? #24

Open MikeD89 opened 4 years ago

MikeD89 commented 4 years ago

Are there any plans to support OpenGL quad-buffered, active stereo rendering?

redrezo commented 4 years ago

drift focuses on getting an OpenGL texture into JavaFX. I'm not sure about what is needed for "quad-buffered active sterio rendering" but i think you would need a high frame rate for it. The displaying of the final image is done by the javafx quantum renderer which which limits the framerate in some ways (although there are ways to increase it like -Djavafx.animation.fullspeed=true)

for quad buffering, in the current version you could acquire 4 render textures and present them whenever you want, however this is not fully tested since it is mostly used to acquire one texture and present it right after rendering to it.

also the next version will have a swapchain mechanism where you can specify the size of your swapchain

MikeD89 commented 4 years ago

Quad buffered rendering is more straightforward than it sounds. If you disregard the camera positioning, at its core its essentially about rendering twice - once into GL_BACK_LEFT, and once into GL_BACK_RIGHT, before swapping the buffers as normal for Double Buffering.

https://www.khronos.org/opengl/wiki/Default_Framebuffer#Color_buffers

I can definitely read multiple render textures, thats no issue at all. My trouble is finding a way to present them using hardware based stereo rendering (NVIDIA 3D Vision in my case). I'm not sure if this is possible at all in JavaFX.

Fortunately in my application I can currently achieve the necessary framerate for stereo, using LWJGL 2.9.3 and an AWT/Swing UI implementation. I would be looking in the future to move to LWJGL 3 and JavaFX, using DriftFX to connect the two worlds together.

redrezo commented 4 years ago

JavaFX renders its scene graph with its quantum renderer to a single os surface, the composition of our texture and the rest of the scene happens in there. We just "smuggle" our texture into JavaFX. I think it does not support quad buffered rendering - but to make sure you can have a look at its sources.

I think you need to do it the other way around if you want to have a javafx ui - let javafx render into a texture and blit that above your OpenGL scene. Drift only supports OpenGL -> JavaFx. But this reverse mode would be a nice feature for DriftFX.