Open adamish opened 3 years ago
The JOGL API docs it specifically says its inbuilt flipping should not be used at all, and that users should turn it off and perform the flipping themselves in the client code. Other people have reported this as being a bug too, e.g. here
This GLSL-based flipping requires that the OpenGL Fixed Function Pipeline be in a known and 'normal' state (e.g. all the various settings like glFrontFace, glTexture, etc are set to default values). WorldWind must be setting them to something strange and incompatible at the point where the flipping is invoked (at the end of the final display() callback).
The way to turn off this GLSL flipping, but retain overall GLSL capability, is to call this API function on the WorldWindowGLJPanel after construction:
canvas.setSkipGLOrientationVerticalFlip(true);
The JOGL API docs recommened that client code should instead perform this vertical flipping themselves, e.g. a scaling via the Projection matrix.
So possible solutions are:
Note that I cannot find any definitive reason this problem is specifically limited to RedHat8/Ubuntu - yet I am sure there must be some reason, or this problem would have been spotted by any testing on WorldWindowGLJPanel.
Another workaround is to add a GLEventListener which effectively does nothing. It is unclear why this works. Speculation is that this somehow flushes the pipeline.
Credit to @Jebonicus for this.
worldwindCanvas.addGLEventListener(0, new VSyncBugWorkaroundGLEventListener());
public class VSyncBugWorkaroundGLEventListener implements GLEventListener {
...
@Override
public void display(GLAutoDrawable drawable) {
drawable.getGL().glDrawArrays(GL.GL_LINES, 0, 1);
}
...
}
Description
A small WorldWindowGLJPanel example shows large blue pixels on Redhat 8/Ubuntu 20.04, exact same code on Redhat 6 works correctly. Also equivalent WorldWindowGLCanvas works correctly.
Problem appears related to GLSL flipping. If "jogl.gljpanel.noglsl" property is set to true then WorldWind works correctly, however in a large application this was unusable as some layers were positioned incorrectly and went in opposite direction to panning (i.e. vertically flipped)
Also a simple Hello World for JOGL with GLJPanel (copied from https://www.javatpoint.com/jogl-hello-world) works correctly indicating problem may be closer to WorldWind than JOGL
Steps to Reproduce
Expected behavior: Normal display
Actual behavior: Large blue pixels
Reproduces how often: 100%
Operating System and Version
Additional Information
Logs