问题描述
在地图上滚动时,偶尔会出现一条白线闪烁。我正在尝试回答以下两个问题:
- 为什么会出现白线?
- 什么可能的解决方案可以确保地图没有闪烁的线条?
任何帮助或提示将不胜感激!请查看我的日志如下:
使用 Xcode 的“Capture GPU Frame”功能,并选择“View Frame by Program”,然后在“Program Program Object #5”中出现白线。
这是来自 gpu 跟踪的代码:
//************************************************************************
// Edits to captured shaders are not saved to the source shader file.
// copy them back to your shader files when done or retrieve them from
// the GPU Debug Log.
//************************************************************************
precision highp float;
uniform mat4 uMVPMatrix;
uniform float uPixelSize;
uniform float uZoomInterpolation;
uniform float uCameraviewingAngle;
uniform float uCameraZoom;
uniform vec2 uCameraAxis;
uniform float uWidenConstantWidth;
uniform float uWidenIntensity;
attribute vec2 aOrigin;
attribute vec2 aVector;
attribute vec2 aDirection;
attribute mediump vec2 aTombstoneTexCoords;
attribute lowp vec4 aColorStart;
attribute lowp vec4 aColorEnd;
attribute mediump vec2 aWidthRange;
varying lowp vec4 vstrokeColor;
varying mediump vec2 vTombstoneTexCoords;
const float kFixedPointConversionFactor = 0.0000610351562;
const float kFixedPointVectorConversionFactor = 0.0001220703125;
const float kOneEighthsDPConversionFactor = 0.125;
const float kWidenLowViewAngle = 0.685;
const float kWidenHighViewAngle = 0.785;
const float kWidenLowZoomFade = 13.0;
const float kWidenHighZoomFade = 15.0;
const float kWidenLowDepth = 0.5;
const float kWidenHighDepth = 5.0;
const float kWidenLinearDepthWidth = 4.0;
const float kWidenSquaredDepthWidth = 5.333;
float additionalWidth(float z) {
float depth = smoothstep(kWidenLowDepth,kWidenHighDepth,z);
float width = (depth * kWidenLinearDepthWidth) + (depth * depth * kWidenSquaredDepthWidth);
vec2 direction = aDirection * kFixedPointConversionFactor;
float angleFactor = 1.0 - abs(dot(direction,uCameraAxis));
width *= angleFactor;
float viewingAngleFactor =
smoothstep(kWidenLowViewAngle,kWidenHighViewAngle,uCameraviewingAngle);
float zoomFactor = smoothstep(kWidenLowZoomFade,kWidenHighZoomFade,uCameraZoom);
float factor = viewingAngleFactor * zoomFactor * uWidenIntensity;
width *= factor;
return width;
}
void main() {
float strokeWidth = mix(aWidthRange.x,aWidthRange.y,uZoomInterpolation);
strokeWidth *= kOneEighthsDPConversionFactor;
vstrokeColor = mix(aColorStart,aColorEnd,min(uZoomInterpolation,1.0));
vTombstoneTexCoords = aTombstoneTexCoords * kFixedPointConversionFactor;
vec2 vector = aVector * kFixedPointVectorConversionFactor;
vec2 extrusion = vector * (strokeWidth * uPixelSize);
vec2 origin = aOrigin * kFixedPointConversionFactor;
vec4 position = vec4(origin + extrusion,0.0,1.0);
position = uMVPMatrix * position;
strokeWidth += additionalWidth(position.z) + uWidenConstantWidth;
extrusion = vector * (strokeWidth * uPixelSize);
position = vec4(origin + extrusion,1.0);
position = uMVPMatrix * position;
gl_Position = position;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)