Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointPlacemark labels should be on depth buffer if clipHorizon is false #282

Open
smartalex32 opened this issue Nov 1, 2024 · 0 comments

Comments

@smartalex32
Copy link

Description

When using PointPlacemark, back in about 2017, there was the clipToHorizon member variable and accessors added. This would allow the Placemark object to be clipped at horizon line or overriden to not clip at the horizon line. The problem is that if the user says to NOT clip at the horizon, then the labels are not added to the depth buffer, and so they render in front of the globe when the PointPlacemark moves behind the globe.

In the forum post below they list different solutions to handle rendering the label, but it appears to just move the label to the bottom left of the screen permanently instead of keeping it in the default position based on screen location of the placemark. When I include code to keep close to the placemark, their solution still has the label rendering in front of the globe.

https://forum.worldwindcentral.com/forum/world-wind-java-forums/development-help/16581-how-to-prevent-clipping-of-objects-beyond-the-horizon

In PointPlacemark.java in the drawLabel() method at line 1200 there is code that disables the depth.

1199 // Do not depth buffer the label. (Placemarks beyond the horizon are culled above.)
1200 gl.glDisable(GL.GL_DEPTH_TEST);
1201 gl.glDepthMask(false);

The comment states that it is disabling depth test because "Placemarks beyond the horizon are culled above." but if the user sets the clipToHorizon to false, then they won't be clipped.

I feel like since the ability to override the default behavior was exposed, the other base renderables should have their default behavior change depending on the flag.

Steps to Reproduce

Assumes a basic application with globe and a layer already created

  1. Create a PointPlacemark and setClipToHorizon(false)
  2. SetDrawLabel(true) on PointPlacemarkAttributes and setLabelText() to a test label on the PointPlacemark
  3. Spin the globe until the placemark is behind the globe
    *Note: the Placemark disappears, but the label is seen through the globe.

Expected behavior:
The label should disappear behind the globe like the placemark if clipToHorizon is false.

Actual behavior:
The label is seen through the globe when clipToHorizon is false.

Reproduces how often:
Every time.

Operating System and Version

Windows, Java 11, and WorldWind 2.2.1

Additional Information

I've tried creating a wrapped PointPlacemark, and overriding the drawLabel() method so that I can set the GL_DEPTH_TEST enabled and keep all the same code, and it did not work. I'm not an expert at OpenGL so there may be a simple fix, but I believe this is a behavior issue that I wouldn't expect to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant