The state of offscreen rendering

Hello!

I would like to use JOGL for offscreen rendering so that I could use the rendered images in a Swing program. The rendering does not have to be hardware-accelerated.

I would thus ask you whether it is possible in the current version of JOGL. I have been searching for this and I have not found any working code. The code at:

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jogl;action=display;num=1077239979;start=1#1

seems to be very long as for simply saving an image of an offscreen rendered scene, is not this a result of some missing features in JOGL API? Or should the code really be such as in that example?

By the way, the code does not work on my system FC3/JOGL 1.1 b07:

$ java OffscreenGLEL
java.lang.NullPointerException
at net.java.games.jogl.impl.x11.X11GLContext.chooseVisual(X11GLContext.java:319)
at net.java.games.jogl.impl.x11.X11OffscreenGLContext.create(X11OffscreenGLContext.java:148)
at net.java.games.jogl.impl.x11.X11GLContext.makeCurrent(X11GLContext.java:145)
at net.java.games.jogl.impl.x11.X11OffscreenGLContext.makeCurrent(X11OffscreenGLContext.java:133)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:250)
at OffscreenPanel.resizeContext(OffscreenPanel.java:40)
at OffscreenPanel.(OffscreenPanel.java:34)
at OffscreenGLEL.(OffscreenGLEL.java:31)
at OffscreenGLEL.main(OffscreenGLEL.java:13)

Is this possible for the the code be shorter in JOGL? Is there a cross-system reliable method of either hardware or software rendering of offscreen scenes? Or perhaps it is curently better to render to some iconified window? Would it work?

PBuffers are a bitch as the OpenGL implementation is different between various OSes. There are other inconveniences with PBuffers that make them inefficient as well. I’ve not looked into using PBuffers with JOGL, but it appears that JOGL attempts to hide some of the specifics in regard to particular platform dependent GL extensions that are required.

No…

What I am really really really… really waiting for is for the new render to target (RTT) extension that is still not finalized.

http://www.opengl.org/resources/features/GL_EXT_render_target.txt

Once this is implemented by the IHV vendors (maybe 6 months if all goes well?) then things will be completely different regarding render to texture and offscreen rendering. I am waiting with eager ears to hear any new info regarding this extension after the ARB meeting that should be happening soon.

Some threads to follow on the OpenGL board regarding this are:
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=012414
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=012751

Best of luck in your attempts to get Pbuffers working on FC3…

Thanks.

I have just tried some demo from Java3D that should take snapshots of the scene, but it did not work - only background color was in the snapshots.

So perhaps the scene rendered on the screen could be “acquired” from the video memory - could it be done within JOGL? Or can JOGL-rendered scenes be used with java.awt.Robot.createScreenCapture? If yes, in which part of scene drawing should the method be used?

Perhaps you can back up and explain your need and usage of offscreen rendering in your Swing app. What functionality of OpenGL/JOGL do you need especially when you mention that you are not concerned with hardware acceleration? How will you be using the images created from JOGL in your Swing app? Perhaps Java2D will meet you needs as it is quite powerful.

I needed images of 3d scenes in my program, and primarily wanted to use JOGL to render them. But because of the problems with offscreen rendering, and because I did not need the hardware acceleration of the rendering, I decided to use POVRAY. That has the additional advantage of many advanced features of POVRAY like photon maps.

Thanks for help!