Skip to content

Commit 7d3e346

Browse files
committed
Read depth texture value from R/X component instead of Z.
Set sempler2d to highp explictly.
1 parent 0dacfec commit 7d3e346

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

worldwind/src/main/res/raw/gov_nasa_worldwind_sightlineprogram_frag.glsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
#ifdef GL_FRAGMENT_PRECISION_HIGH
77
precision highp float;
8+
uniform highp sampler2D depthSampler;
89
#else
910
precision mediump float;
11+
uniform mediump sampler2D depthSampler;
1012
#endif
1113

1214
uniform float range;
1315
uniform vec4 color[2];
14-
uniform sampler2D depthSampler;
1516

1617
varying vec4 sightlinePosition;
1718
varying float sightlineDistance;
@@ -32,7 +33,7 @@ void main() {
3233
/* Compute a mask that's on when the object's depth is less than the sightline's depth. The depth texture contains
3334
the scene's minimum depth at each position, from the sightline's point of view. */
3435
vec3 sightlineCoord = clipCoord * 0.5 + 0.5;
35-
float sightlineDepth = texture2D(depthSampler, sightlineCoord.xy).z;
36+
float sightlineDepth = texture2D(depthSampler, sightlineCoord.xy).r;
3637
float occludeMask = step(sightlineDepth, sightlineCoord.z);
3738

3839
/* Modulate the RGBA color with the computed masks to display fragments according to the sightline's configuration. */

0 commit comments

Comments
 (0)