3D polygon in JavaFX


Question

Is there a 3D polygon in JavaFX (similar to QuadArray in Java3D)?
If there isn't what is the simplest way to create one? Creating two triangles?
If there is no simple way than should I use 3rd party 3D library? But that would beat the idea of using JavaFX in the first place.

I would like the abbility to switch between faces, wire-mode and verts-only-mode.

1
2
12/31/2012 10:01:50 PM

Accepted Answer

3D in JavaFX 2.x is pretty limited.

You can create a 3D polygon by creating a 2D polygon and performing a transform on it.

There are some 3D samples in the Ensemble application which demonstrate how to do this (with source code). There is a simple cube sample here.

With JavaFX 2.x, you could implement switches between face view, wireframe view and vertex only view with little difficulty. Other things like complex lighting, effects, mesh loading, realistic shading etc, would be more difficult and would be better implemented in JavaFX 8.

JavaFX 8 will have a much more robust and useful 3D implementation. You should evaluate the capabilities of the current JavaFX 3D demos in Ensemble as well as the proposed JavaFX 8 3D feature set against your requirements and other 3D libraries such as lwjgl to determine what will best fit your needs. Note, JavaFX 8 is not scheduled for final release until September 2013. Over time the proposed JavaFX 8 3D features will be added to the Java 8 pre-release.

I did create a simple 3D software renderer for a JavaFX ImageView which I might open source if interested - it renders bitmaps onto an ImageView though - not directly to the JavaFX scene graph primitives. A similar thing, but using a hardware renderer via the Java3D API was created by Interactive Mesh. Unlike JavaFX 8, it has the advantage of being available today.

1
1/1/2013 6:17:16 AM

https://wikis.oracle.com/display/OpenJDK/3D+Features

JavaFX 8 includes a full 3D library. I currently am working with it, but it can be buggy + it's not even fully ready for dev's yet, or even close for the general release.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon