Fail to run a depth peeling example

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

Fail to run a depth peeling example

Martin
Hi,

Did any of you tried to run the dual depth peeling port of abokinsky ?

Running it fails on this line:
gl.glTexImage2D( GL2.GL_TEXTURE_RECTANGLE_ARB, 0,  GL2.GL_FLOAT_R32_NV, g_imageWidth, g_imageHeight, 0,  GL2.GL_RGBA,  GL2.GL_FLOAT, null);

Replacing GL2.GL_FLOAT_R32_NV by GL2.GL_RGBA16F avoids crashing (well crashes later with something seamingly different related to shade_fragment.glsl)

I'm running windows 7 64bits.
I first used 2.0 rc2 (http://jogamp.org/deployment/archive/rc/v2.0-rc2/) and then rc5 (http://jogamp.org/deployment/archive/rc/v2.0-rc5/) with similar result:

Exception in thread "main-AWTAnimator-1" javax.media.opengl.GLException: javax.media.opengl.GLException: Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error codes after a call to glTexImage2D(<int> 0x84F5, <int> 0x0, <int> 0x8885, <int> 0x400, <int> 0x300, <int> 0x0, <int> 0x1908, <int> 0x1406, <java.nio.Buffer>): GL_INVALID_ENUM ( 1280 0x500),
        at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:98)
        at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:197)
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:164)
        at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:767)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:388)
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:74)
        at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:140)
        at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:180)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.media.opengl.GLException: Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error codes after a call to glTexImage2D(<int> 0x84F5, <int> 0x0, <int> 0x8885, <int> 0x400, <int> 0x300, <int> 0x0, <int> 0x1908, <int> 0x1406, <java.nio.Buffer>): GL_INVALID_ENUM ( 1280 0x500),
        at javax.media.opengl.DebugGL2.checkGLGetError(DebugGL2.java:32455)
        at javax.media.opengl.DebugGL2.glTexImage2D(DebugGL2.java:22583)
        at demos.dualDepthPeeling.DualDepthPeeling.InitAccumulationRenderTargets(DualDepthPeeling.java:298)
        at demos.dualDepthPeeling.DualDepthPeeling.init(DualDepthPeeling.java:984)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:155)
        at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:175)
        at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:856)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:356)
        at javax.media.opengl.awt.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:890)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Thread[AWT-EventQueue-0,6,main] glGetError() returned the following error codes after a call to glViewport(<int> 0x0, <int> 0x0, <int> 0x3F0, <int> 0x2DA): Unknown glGetError() return value: ( 1286 0x506),
        at javax.media.opengl.DebugGL2.checkGLGetError(DebugGL2.java:32455)
        at javax.media.opengl.DebugGL2.glViewport(DebugGL2.java:4659)
        at jogamp.opengl.GLDrawableHelper.reshape(GLDrawableHelper.java:201)
        at jogamp.opengl.GLDrawableHelper.reshape(GLDrawableHelper.java:210)
        at javax.media.opengl.awt.GLCanvas$DisplayAction.run(GLCanvas.java:869)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:363)
        at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:769)
        at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:388)
        at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:487)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:310)
        at java.awt.Component.dispatchEventImpl(Component.java:4706)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

gouessej
Administrator
Hi

You get this error (invalid enumerant) because this format is not supported on your hardware.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

Martin
Example is now working great!!

I finally could get rid of this error by specifying in Nvidia settings to always use GPU :/ For others look here:



Before finding this, I failed with some shader errors. I report them here for other developpers that may fail to run programs with shaders on similar laptop with alternative integrated GPU.

1) Trying to load shade_fragment.glsl, I got an error saying:
"ERROR: 0:25: 'fmod' : no matching overloaded function found - implicit conversion not allowed"
for this following line:
color.rgb = (fmod(i, 2.0) == 0) ? vec3(.4,.85,.0) : vec3(1.0);
By looking on the web it seams fmod really exists and is modulo function. Thanks to a #if in the shader code, I can execute another code block instead an continue to next error :)

2) In dual_peeling_peel_fragment.glsl, I got some errors, the first one saying:
"ERROR: 0:10: '' :  extension 'ARB_draw_buffers' is not supported"

Looking at a wikipedia article let me think ARB will be supported on a very limited subset of computers: "Most non-nVidia OpenGL implementations do not provide the nVidia ARB assembly extension and do not offer any other way to access all the shader features directly in assembly, forcing the use of GLSL even for machine generated shaders where assembly would be more appropriate."

Regards,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

Martin
Those wishing to study depth peeling with this example can find it packaged as a standalone eclipse project with JOGL2 rc5 jars bundled:

http://www.jzy3d.org/misc/depthpeeling/org.jogl.demos.dualdepthpeeling.zip
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

gouessej
Administrator
Thanks.

As far as I know, no scenegraph smartly handles the GPU change at runtime, such changes should be prevented.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

elect
If you press 2 (that is you switch to "front to back peeling mode") is it still working?

Because on my pc it freezes and I dont see any exceptions in the console..

However no problem the dual depth peeling, weighted average and weighted sum mode (1, 3 and 4), but the front to back doesnt work..

Are you guys experiencing the same?
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

gouessej
Administrator
Please use jstack or jvisualvm to see why it freezes.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

elect
gouessej wrote
Please use jstack or jvisualvm to see why it freezes.
I cant see anything wrong, but I dont know if I am using it properly... would you mind taking a look to a snapshot?
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

elect
In reply to this post by Martin
Martin wrote
Those wishing to study depth peeling with this example can find it packaged as a standalone eclipse project with JOGL2 rc5 jars bundled:

http://www.jzy3d.org/misc/depthpeeling/org.jogl.demos.dualdepthpeeling.zip
This example is working great, no problem also with simple depth peeling

Thanks Martin
Reply | Threaded
Open this post in threaded view
|

Re: Fail to run a depth peeling example

Martin
Hi,

For those interested in the depth-peeling example discussed above, note that some changes were required to run on computer not having an NVidia GPU.

I made the changes in Jzy3D integration - which can be reviewed here. There is a good web page summarizing all the required changes here. The examples can be run from Jzy3D here.

Comparing results on a macOS with NVidia GPU and the other one with the M1 chip, I noticed that
- Only one peeling algorithm really work on M1 (weighted average peeling).
- 3/4 peeling algorithm work on Ubuntu 20 running + Intel Iris as well as macOS 10.12+NVidia (weighted sum peeling makes overlapping fragments of geometries with alpha look black)