4

I am creating a software for calculating gearbox parts using Swing and OpenGL (with JOGL). With this software the calculated parts are shown in 3D. The following picture shows an example part:

PGS

At first the geometry is specified/calculated (tip/root Diameter, width, number of teeth...) and out of this data the 3D-part is created. This example part is made with JOGL-Code because it's easy to use for me and can be integrated in a Swing-GUI.

Now a played around a bit with JavaFX Application GUI's and decided to continue making my software in JavaFX because it offers everything i need, looks much better and so on. The problem is I can't use my JOGL-OpenGL graphics.

So here are the possibilities for me:

  • Search for a way to integrate OpenGL-graphics in a JavaFX-Application - but I googled a bit and this seems to be quite difficult and the possible solutions seem to be very slow.
  • Use JavaFX integrated 3D-graphics (TriangleMesh) - but this is difficult to understand and I can't find good examples to learn it.
  • Any other solution?

Can you please help me finding a good solution? What would you do? My favorite would be to continue using OpenGL, but is there any good solution for this yet?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
ohoeppner
  • 173
  • 3
  • 10
  • Have you tried my multiple suggestions? https://jogamp.org/bugzilla/show_bug.cgi?id=607 You might have some performance problems but it depends on the complexity of your meshes too. – gouessej Dec 28 '14 at 14:37
  • I understand your frustration and concerns regarding TriangleMesh. It took me a while to get "comfortable" with it. I have not done much with openGL, but the mesh structures when it all boils down are very similar.. Points(vertices), TexCoords(uv's), and Faces(triangles). Converting them should be fairly straight forward. – jdub1581 Dec 28 '14 at 23:01
  • @goussej: Thanks for the link
    @jdub Is there any good documentation or tutorial for that? I have some examples but was not able to unserstand, what TexCoords and Faces are and how to calculate the correct values for that. Where should i start?
    – ohoeppner Dec 29 '14 at 14:10
  • Looks Like Jose took care of you in the comments below... – jdub1581 Dec 30 '14 at 00:12

1 Answers1

3

If you are looking for some JavaFX 3D resources that may help you decide whether its already mature or not, these are available, among others:

  • 3DViewer here from the OpenFJX project.
  • InteractiveMesh importers and browser.
  • F(X)yz, a new JavaFX 3D library that provides additional primitives, composite objects, controls and data visualizations that the base JavaFX 8 3D packages do not have.
  • Multimodel3DFX, repository contains the code for the example shown on the article "Building Castles in the Sky. Using JavaFX 3D to model historical treasures" published in Oracle Java Magazine, issue from November/Dicember 2014.

Using a PolyLine3D from F(X)yz and the Multimodel3DFX plaftorm I was able to extrude a 2D polyline of a spur gear, so you can see how it's rendered in a JavaFX 3D subscene:

Spur Gear

These are also mathematical 3D models generated using the F(X)yz library, all of them based on TriangleMesh.

3D shapes

As you can see, JavaFX 3D API, with its pros and cons, can be easily extended to achieve complex tasks.

José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • Wow - this Looks very promising. Thanks alot for your help. I already downloaded the F(X)yz and took a look at all examples. I also downloaded the Multimodel3DFX from you, but where can I run an Application to see that castle you described? And how do I extrude a Polyline3D? The spur gear in your Picture Looks very very nice. – ohoeppner Dec 29 '14 at 14:19
  • Thanks, in F(x)yz you'll find (in code) enough info to get you started with any TriangleMesh. But you could make a feature request if you provide us with some details about your shapes, and we could add some sample gears like the one shown in my answer. The Multimodel3DFX project has a small model to test, the big one is not available. – José Pereda Dec 29 '14 at 14:29
  • I already found out how to extrude the polyline (width is within the constructor) and how to start the model of your Multimodel3DFX (NavigationFX.java). This is enough to play around some hours :-) But one more question - In OpenGL I have to specify coordinates of the triangle and the vector normal to that triangle (cross product of two vectors from the triangle) for lighting. But how is it in JavaFX-3D? I don't see any any connection between the the geometry Points and the faces/texture values in the examples i have. Where can i find a good explaination for that? – ohoeppner Dec 29 '14 at 15:12
  • For now, you just need vertices coordinates, texture coordinates, and faces (list of indices of vertices and textures). Normals are not necessary, but they could be used to calculate the smoothing groups. As I said, in F(X)yz `org.fxyz.shapes.primitives` package you'll find enough examples to get you started. And by the way, if you consider this a valid answer, mark it as accepted so others may find it useful too. – José Pereda Dec 29 '14 at 15:32