Skip to content

Commit

Permalink
Fix globe atmosphere on Android (mapbox#11610)
Browse files Browse the repository at this point in the history
Computation and varying require highp in OpenGL ES.

Co-authored-by: Aleksandar Stojiljković <[email protected]>
  • Loading branch information
2 people authored and ahocevar committed Mar 23, 2022
1 parent 8c2de4b commit 886d892
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/shaders/globe_atmosphere.fragment.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ uniform vec3 u_end_color;
uniform highp vec3 u_globe_pos;
uniform highp float u_globe_radius;

varying vec3 v_ray_dir;
varying highp vec3 v_ray_dir;

void main() {
vec3 dir = normalize(v_ray_dir);
vec3 closest_point = abs(dot(u_globe_pos, dir)) * dir;
highp vec3 dir = normalize(v_ray_dir);
highp vec3 closest_point = abs(dot(u_globe_pos, dir)) * dir;
float norm_dist_from_center = length(closest_point - u_globe_pos) / u_globe_radius;

if (norm_dist_from_center < 1.0)
Expand Down
2 changes: 1 addition & 1 deletion src/shaders/globe_atmosphere.vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ uniform vec3 u_frustum_tr;
uniform vec3 u_frustum_br;
uniform vec3 u_frustum_bl;

varying vec3 v_ray_dir;
varying highp vec3 v_ray_dir;

void main() {
v_ray_dir = mix(mix(u_frustum_tl, u_frustum_tr, a_uv.x),
Expand Down

0 comments on commit 886d892

Please sign in to comment.