Bug 936 - Nearer objects show up behind closer objects
Summary: Nearer objects show up behind closer objects
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 2.3.0
Hardware: pc_all linux
: --- normal
Assignee: Sven Gothel
Depends on:
Reported: 2014-01-04 01:55 CET by Wyatt
Modified: 2019-03-29 17:54 CET (History)
1 user (show)

See Also:
Type: ---
SCM Refs:
Workaround: ---

Small program demonstrates this bug (176.61 KB, application/x-compressed-tar)
2014-01-04 01:55 CET, Wyatt
Simplified test program (13.19 KB, application/x-compressed-tar)
2014-01-06 22:36 CET, Wyatt

Note You need to log in before you can comment on or make changes to this bug.
Description Wyatt 2014-01-04 01:55:53 CET
Created attachment 571 [details]
Small program demonstrates this bug

After upgrading from a very old version of JOGL-1, which worked fine, I found that our 3D bar and scatter plots render objects in the wrong order as they are rotated (nearer objects may show up behind farther objects, though their size is shown correctly).

This has been observed both on 64-bit Linux and Windows-8, with both OpenJDK and Solaris java 7. Depth testing is enabled (VisRenderer.java) but aside from updating from the old version of JOGL to the latest version I have no experience with it so it may be that I'm missing something basic here.

Some screenshots of this effect on a bar chart can be seen here:


The attached demo program recreates the effect with a basic scatter plot example. Rotating the chart you will see points that should be in the back pass in front of nearer points. This can be easier to see if you use the slider to increase the size of the points.

To build and run the example edit the makefile so JOGL_SRC points to your /jogamp-all-platforms/jar directory (or wherever the relevant jars are located) and do make. To run the example do make run. You can simplify the plot by adjusting the values array on line 127 of ScatterPlotExample.java

Please let me know if you have any questions or if there is anything else I can do to help track down a resolution to this issue.

The JOGL version I'm using is:
build version 2.1.3-rc-20131212, based on:
              branch  origin/master
              commit  ccfc9b529b1dbd6003a62cb4215e2cdaeb8c37fd

Comment 1 Wyatt 2014-01-06 22:36:22 CET
Created attachment 572 [details]
Simplified test program

This is a significantly simplified code base for the test case. You can zoom in and out with the mouse wheel to make the incorrectly overlapping spheres more obvious. The majority of the rendering and control of rotation and zooming of the scene takes place in VisRenderer.java. 

This simplified test also displays a problem I had encountered earlier in my JOGL upgrade process but thought had been fixed with an update. When dragging the application from one monitor to another (on a dual monitor setup with Ubuntu running their default Nouveau drivers) the window sticks to the edge of the new monitor. That behavior in itself is ok, but at the same time the rendered scene goes blank and does not return.
Comment 2 Sven Gothel 2014-09-21 02:16:01 CEST
Wyat, I just downloaded your code and compiled it w/ 2.2.1
(did the little patch getWidth() -> getSurfaceWidth(), etc.

I fail to see the issue, sorry.
Either my 3D vision is insufficient (no lighting, all red balls) or
it doesn't show up here.

I dumped the requested/chosen GLCaps in your GLEL:

Requested: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, stereo, hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]

Chosen   : GLCaps[glx vid 0x29, fbc 0x111: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]

So depth 24 bits should be fine
and I see that you do enable 'gl.glEnable(GL.GL_DEPTH_TEST)'.

Maybe you can attach an OK picture and an ERROR picture.
Or is the issue already solved ?
Comment 3 Sven Gothel 2014-10-09 07:43:25 CEST
closing due to lack of reply and not able to reproduce.

pls reopen if bug still exists and 
offering more collaboration to fix the issue.