JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

classic Classic list List threaded Threaded
214 messages Options
1 ... 67891011
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
Hi,

I not sure what is a typical usecase in sense of a 3D library. But I know what I did with a Raster. It is used in the RasterTextLabel class (http://svn.j3d.org/code/trunk/src/java/org/j3d/renderer/java3d/geom/RasterTextLabel.java), which I used as a basis to display AttributedStrings. This is needed for my application to label coordinate system axis. You can see examples at the images realized with Java3D.





These are just BufferedImages with transparent backround and drawn AttributedStrings, which always has the same size on the screen no matter of the distance from the camera/screen.

I thought about using the BMText which seems to be able to do this. But it would be to be able to use the system/default application font and I need sub- and superscripts.

The coordinate system is one of the last things to finish the replacement of Java3D with Jogamp's Ardor3D continuation. Due to the use of Jogamp's Ardor3D continuation the code is much simpler. Really nice to work with and thanks to all. An example image of the application is shown below..

An other question is, how would you realize a gradient paint in the background. Using Java3D I used the Background class. I wasn't able to find an example in Jogamp's Ardor3D continuation.



Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
Hi

You can just draw a quad as a background (it's very close to what is done in plain JOGL), you have to draw it before the rest of the scene and to disable the depth test.

I'm almost sure that there is something doing the same than RasterTextLabel.java in ardor3d-ui but I'm reluctant to use the default/system font as there is a clear separation between AWT and NEWT in the engine so if it is doable, it will rely on a separate code path to avoid forcing the use of AWT everywhere. I'll have to investigate a bit more... There is another solution to render TrueType fonts with JOGL and AWT, look at the issues on Github.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
I was able to create an simplified BMText class, so that it works with an AttributedString for my case. So the next step was done.

But to be honest I have no idea how the realize the direct quad drawing without depth test. Is there an example anywhere?

Andreas
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
Look at RenderQueueExample to see how to use the queues. Search GL_DEPTH_TEST in the code. Create a mesh data containing 2 triangles or a single quad and affect some colors to the vertices.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
In reply to this post by Andreas
Hi

I have reproduced and fixed the bug reported by Andreas in JogAmp's Ardor3D Continuation.

I have updated JMonkeyEngine 3 so that it uses JOGL 2.3.2 and it's now possible to choose between the forward compatible profile or the backward compatible profile.

I have to update LibGDX soon too.

Best regards.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
Hi,

I added my version of a RasterTextLabel and a GradientBackground to my TabbedPaneExample (https://github.com/AndiMb/Ardor3DTabbedPane). So if someone needs an basis for own implementations this could be used. As Julien said a drawback is the dependency on AWT.

An example image:



Andreas
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
Hi

I know that there is no widely accepted alternative to Swing and AWT yet, except OpenJFX/JavaFX. Good job. I think that I'll probably use your code to write a small example suitable for scientific visualization strictly respecting the implicit and explicit guidelines, i.e:
- no dependency on a particular IDE
- no code duplication (there is already something the same thing than resizeCanvas() somewhere, it's more or less the same for the mouse control)
- no abuse of the runtime cleanup (ContextGarbageCollector.doRuntimeCleanup() shouldn't be called for each frame)
- no superfluous use of AWT (the gradient can be computed without creating a buffered image, then the AWT image loader is useless too, it would be better not to use the AWT fonts)
- no useless header
- the license of the code should be mentioned

I'm happy to see that you succeeded in creating a nice small example with JogAmp's Ardor3D Continuation.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
Hi,

thank's for the hints! They are completely right.

I have a question concerning the code duplication. I haven't found something like the mouse control. I found the FirstPersonControl and the OrbitCamControl. The first one rotates the camera at its position and the second one rotates the camera around a focus point. What I needed was a rotation of the viewing object so that the lights and camera have a fixed position to each other. This is not the case for the OrbitCamControl. Did I miss something?

I have to add the RaserTextLabel which is mostly duplicated code of the com.ardor3d.ui.text.BMText.java class. But as mentioned before in this case I need the AWT fonts.

I'm having a last problem. If I want to reuse the Ardor3DPanels (JoglSwingCanvas) which is internally done for the tabs in a netbeans RCP it doesn't work. If I remove and add the panel from the parent component, all lights and sometimes even the correct scaling is gone. I changed my example to show the effect. Is there any hint to avoid that?

Andreas

Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
I'll check by myself what could be avoided when I create the new example, I'll let you know.

It's possible to have the same fonts than AWT without using it.

Is your problem linked to the use of Netbeans Platform?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
Hi,

I have one question about the transparency of objects. I added a Teapot to a scene and set the transparency by the following code:

        targetMesh.setDefaultColor(new ColorRGBA(0, 1, 0, 0.4f));
        targetMesh.setSolidColor(new ColorRGBA(0, 1, 0, 0.4f));
        // Add a material state
        final MaterialState ms = new MaterialState();
        targetMesh.setRenderState(ms);
        // Pull diffuse color for front from mesh color
        ms.setColorMaterial(MaterialState.ColorMaterial.Diffuse);
        ms.setColorMaterialFace(MaterialState.MaterialFace.FrontAndBack);
        // Set shininess for front and back
        ms.setShininess(MaterialState.MaterialFace.FrontAndBack, 100);

        BlendState blend = new BlendState();
        blend.setBlendEnabled(true);
        targetMesh.setRenderState(blend);

        targetMesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);

I'm getting the result shown in the image. I don't understand why one side of the teapot is darker than the other and how to avoid this behaviour.



I hope somebody can give my an advise.

Andreas
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

elect
that happens because with transparency you need to order from back to front (or viceversa) the object you render to obtain a correct blending step-by-step
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

ElvJOGL
In reply to this post by gouessej
I am new to this forum and to JOGL, this is great work and great news.

I have tried learning JME3 in the past, but too bad they will not include your work of JOGL 2.

Hopefully something better is there, and maybe Ardor3D that does supports JOGL replaces JME. I am starting to not like JME anyways.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
In reply to this post by elect
Hi,

thanks for the answer. How can I avoid this behaviour? Even if you build a cylinder with quads as one mesh, you're getting the same as seen in the image. I don't know how to sort inside one object?

Andreas
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

elect
Andreas wrote
Hi,

thanks for the answer. How can I avoid this behaviour? Even if you build a cylinder with quads as one mesh, you're getting the same as seen in the image. I don't know how to sort inside one object?

Andreas
You need Order Independent Transparency, you can take a look at this OIT showcase project of mine

Where do you need it, in which program?

Which OpenGL profile does this program use it and which one do you have?
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
In reply to this post by ElvJOGL
ElvJOGL wrote
I have tried learning JME3 in the past, but too bad they will not include your work of JOGL 2.
The JOGL backend of JME3 is in the "official" repository anyway.

ElvJOGL wrote
Hopefully something better is there, and maybe Ardor3D that does supports JOGL replaces JME. I am starting to not like JME anyways.
Ardor3D != JogAmp's Ardor3D Continuation

Maybe my post can show you the pros and cons of them:
http://forum.jogamp.org/OpenGL-OS-X-tp4036147p4036176.html
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
In reply to this post by elect
Hi,

thank's for the answer. I'm trying to switch from Java3D to JogAmp's Ardor3D Continuation as API. I'm working on a scientific program calculating and visualizing the features of composite material (http://www.elamx.de). I want to compare failure bodies where it is useful to show everything transparent to see the difference. A simple example is the following:



So if I create a simple cylinder with JogAmp's Ardor3D Continuation and try to use tranparency with the code above. I'm getting the following result:



This is not the expected result.

Andreas
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

elect
Yeah, I know. Which opengl version do you have available, Andreas?

Julien, would it be possible to implement an algorithm to handle properly transparency?

Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
elect wrote
Julien, would it be possible to implement an algorithm to handle properly transparency?
There is already something in JogAmp's Ardor3D Continuation to choose the order of drawing.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

gouessej
Administrator
In reply to this post by Andreas
You have to use a blend state with a transparent render queue (RenderBucketType.Transparent), see Renanse's excellent answer:
http://stackoverflow.com/a/10264155
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Andreas
Hi,

I'm aleady using the transparent render queue as written in the link. But I found a solution. I had to set TransparencyType.TwoPass. Now it is working.

Andreas
1 ... 67891011