Using Jogl for offscreen image composing (no GUI)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Jogl for offscreen image composing (no GUI)

tarto
Dear all

The idea is to have a remote server processing some commands text file, and composing an image based upon those instructions. I was thinking of using Jogl to render that image offline on a texture or a PBO, and then save the image when done with readPixels for later download.

I am new to Jogl but I understood at least that it is no possible to retrieve a GL object statically. I am thus trying to set a GLCanvas and access the GL object reference through the GLEventListener. At some point GLProfile.initSingleton is always called and throws the following Exception:

com.jogamp.nativewindow.NativeWindowException: X11Util.Display: Unable to create a display(nil) connection

My interpretation is that this is because my remote machine has no GUI (and wont have one). Is this is really the reason of this Exception ? If so, how to get rid of it and how to get a reference of a GL instance for pure offscreen rendering ?

Thank you for any help !
Reply | Threaded
Open this post in threaded view
|

Re: Using Jogl for offscreen image composing (no GUI)

Sven Gothel
Administrator
On 07/29/2015 10:52 AM, tarto [via jogamp] wrote:
> Dear all
>
> The idea is to have a remote server processing some commands text file, and
> composing an image based upon those instructions. I was thinking of using Jogl
> to render that image offline on a texture or a PBO, and then save the image
> when done with readPixels for later download.

Use GLDrawableFactory -> createOffscree*() for FBO/Texture target.

>
> I am new to Jogl but I understood at least that it is no possible to retrieve
> a GL object statically. I am thus trying to set a GLCanvas and access the GL
> object reference through the GLEventListener. At some point
> GLProfile.initSingleton is always called and throws the following Exception:
>
> com.jogamp.nativewindow.NativeWindowException: X11Util.Display: Unable to
> create a display(nil) connection

Yes, we need one WM available .. if supported on the platform.
Here it seems X11 is available but no server running?
In this case, just kick-off an offscreen FB server instance
to satisfy the desktop GL library.

Or .. you have access to an EGL/ES OpenGL driver,
in this case our EGL/ES backend shall work.

GLDrawableFactory has a getter to fetch an instance of
either desktop (here X11) or 'embedded' (EGL/ES).

>
> My interpretation is that this is because my remote machine has no GUI (and
> wont have one). Is this is really the reason of this Exception ? If so, how to
> get rid of it and how to get a reference of a GL instance for pure offscreen
> rendering ?

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using Jogl for offscreen image composing (no GUI)

tarto
Hello Sven
Thank you for the answer, it put me on the right track I think. The whole X11 topic is very new to me, but: I installed Xorg (which was not apparently), and when I log with X-forwading, this assigns a value to the DISPLAY variable which seems to solve the issue as GLProfile.getDefault() is executed correctly, and a proper GLProfile is set.
However it is not the case when user is not connected with X-forwarding.

>Yes, we need one WM available .. if supported on the platform.
>Here it seems X11 is available but no server running?
>In this case, just kick-off an offscreen FB server instance
>to satisfy the desktop GL library.

It seems my issue is to keep a value for DISPLAY somehow (It seems I can not having X11 server running, as startx gives me some errors I need to dig into).
But when you say an "offscreen FB server instance", are you refering to a VNC ? Do you have some reference that I could look into ?

Thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: Using Jogl for offscreen image composing (no GUI)

tarto
Hi Sven,

After reading other posts on the forum and a bit of googling, I finally enabled Xvfb. Now, glxinfo returns without error, and it seems I have the virtual display in place.

I'm now trying to set a Drawable via the factory as you recommended, but to set the capabilities, I apparently need to provide a profile. GLProfile.getDefault() then throws :

com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x65db8b58, isOwner false, <65813fb3, 7c825850>[count 0, qsz 0, owner <NULL>]]]
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
        at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
        at java.lang.Thread.run(Thread.java:745)
Caused by: com.jogamp.opengl.GLException: Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig and XVisual for visualID 0x0, X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x153eb10, owner true, ResourceToolkitLock[obj 0x5bcb6222, isOwner true, <2136122, 509e1001>[count 1, qsz 0, owner <main-SharedResourceRunner>]]], idx 0], GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.sw], on-scr[.]]
        at jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(X11GLXGraphicsConfigurationFactory.java:246)
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createMutableSurfaceImpl(X11GLXDrawableFactory.java:524)
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory.createDummySurfaceImpl(X11GLXDrawableFactory.java:535)
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:283)
        ... 2 more
com.jogamp.opengl.GLException: Profile GL_DEFAULT is not available on X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x65db8b58, isOwner false, <65813fb3, 7c825850>[count 0, qsz 0, owner <NULL>]]], but: []
        at com.jogamp.opengl.GLProfile.get(GLProfile.java:990)
        at com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:721)
        at com.jogamp.opengl.GLProfile.getDefault(GLProfile.java:732)
        at TestGL.main(TestGL.java:28)
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 1/1, reusable (open, marked uncloseable): 0, pending (open in creation order): 1)
X11Util: Open X11 Display Connections: 1
X11Util: Open[0]: NamedX11Display[:1, 0x153eb10, refCount 1, unCloseable false]


Could you indicate how the profile shall be set ?
Thanks for your support.