mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Polygons with transparent fill not drawn properly when tilting camera

Open Schumi09 opened this issue 10 years ago • 2 comments

Hi there,

polygons that have a transparent fill are not drawn properly when tilting the camera.

Platform: Android 4.4.2 (Sony Xperia P) Mapbox SDK version: 4.0.0, 4.1.0-SNAPSHOT

Steps to trigger behavior

  1. Used demo app
  2. Set new Cameraposition with tilt

CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(51.963493, 7.617811)) .zoom(15) .tilt(30) .build(); mMapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

  1. Set up a polygon with transparent fill, e.g.:
    • mapboxMap.addPolygon(new PolygonOptions().add(new LatLng(51.963493, 7.617811)).add(new LatLng(51.964233, 7.620922)).add(new LatLng(51.965575, 7.617070)).fillColor(Color.parseColor("#00000000")) .strokeColor(Color.parseColor("#ff000000")));

Expected behavior

Properly drawn polygons as it is without tilted camera, before 4.0.0 it worked fine I think. I did not test it again, but I'm pretty sure.

Actual behavior

broken_polygon

Schumi09 avatar Apr 26 '16 14:04 Schumi09

You can work around this issue by using adding a line instead of a polygon.


Polygon outlines are drawn with gl.LINES instead of gl.TRIANGLES. The interpolation between vertices does not work the way we expected it to. The -gl-js version of this issue: https://github.com/mapbox/mapbox-gl-js/issues/1047

Switching from gl.LINES to gl.TRIANGLES rendering would fix this https://github.com/mapbox/mapbox-gl-js/issues/2080

ansis avatar Apr 28 '16 03:04 ansis

Thanks for your reply. I already used the work-around ;)

Schumi09 avatar Apr 28 '16 18:04 Schumi09