Login  Register

Re: Java3D in batch mode

Posted by ThomasR on Feb 18, 2019; 11:06pm
URL: https://forum.jogamp.org/Java3D-in-batch-mode-tp4039415p4039552.html

philjord wrote
Unfortunately I'm no Linux server expert so I really can't help with how to get a GraphicsEnvironment working with teh screen unplugged.
I wonder if it's possible to serialize an interactive GraphicsEnvironment, or otherwise fake it?

These days I mostly work with my adaptation of Java3D on Android that has no AWT in it at all, and allows me to simply create an OpenGL surface and give it to Java3D to work on.
new Canvas3D(GLWindow.create(new GLCapabilities(null))).
Is this a new ctr for Canvas3D in Java3D 1.7? GLWindow.create() doesn't return a GraphicsConfiguration does it?

I would mention that in your case (of not having a screen plugged into your GPU card) I would expect GraphicsDevice.getBestConfiguration to work fine. GraphicsDevice.getBestConfiguration eventually through a chain of calls arrives at JoglPipeline.getBestConfiguration which calls new Frame() and there is a chance that any given configuration may be unable to instantiate that Frame, and hence the init code will fail. In that case you might consider using Java3D 1.7 with the Android (no-AWT) adaptation I made.
Is this the ctr above you're talking about?

You need to manually invoke Canvas3D.renderOffScreenBuffer(); and optionally Canvas3D.waitForOffScreenRendering(). But the scene graph can be updated and used as usual and you can do anything you like with the image you give to Canvas3D.setOffScreenBuffer including (for example) saving multiple images as a video like SweetHome3D  does, using Java3D for the lower quality renders and ray tracing for the higher.

Below I’ve written a very small example of what can be easily and quickly done with the off screen canvas.
I apologize for not explaining my situation more carefully, we can already work with the offscreen facilities that Java3D provides, so I made you write some code you didn't have to. Though this might be a good starting point for a unit test to experiment with.

Can we talk about how you've been able to bypass AWT in Java3D 1.7 for offscreen mode for non Android? If you have time.

Tom