Prevent overdraw in PolygonReplay.
This commit is contained in:
@@ -1908,8 +1908,18 @@ ol.render.webgl.PolygonReplay.prototype.setUpProgram_ = function(gl, context, si
|
|||||||
* @param {WebGLRenderingContext} gl gl.
|
* @param {WebGLRenderingContext} gl gl.
|
||||||
* @param {ol.webgl.Context} context Context.
|
* @param {ol.webgl.Context} context Context.
|
||||||
* @param {Object} skippedFeaturesHash Ids of features to skip.
|
* @param {Object} skippedFeaturesHash Ids of features to skip.
|
||||||
|
* @param {boolean} hitDetection Hit detection mode.
|
||||||
*/
|
*/
|
||||||
ol.render.webgl.PolygonReplay.prototype.drawReplay_ = function(gl, context, skippedFeaturesHash) {
|
ol.render.webgl.PolygonReplay.prototype.drawReplay_ = function(gl, context, skippedFeaturesHash, hitDetection) {
|
||||||
|
//Save GL parameters.
|
||||||
|
var tmpDepthFunc = /** @type {number} */ (gl.getParameter(gl.DEPTH_FUNC));
|
||||||
|
var tmpDepthMask = /** @type {boolean} */ (gl.getParameter(gl.DEPTH_WRITEMASK));
|
||||||
|
|
||||||
|
if (!hitDetection) {
|
||||||
|
gl.enable(gl.DEPTH_TEST);
|
||||||
|
gl.depthMask(true);
|
||||||
|
gl.depthFunc(gl.NOTEQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ol.object.isEmpty(skippedFeaturesHash)) {
|
if (!ol.object.isEmpty(skippedFeaturesHash)) {
|
||||||
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
|
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
|
||||||
@@ -1928,6 +1938,13 @@ ol.render.webgl.PolygonReplay.prototype.drawReplay_ = function(gl, context, skip
|
|||||||
end = start;
|
end = start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!hitDetection) {
|
||||||
|
gl.clear(gl.DEPTH_BUFFER_BIT);
|
||||||
|
gl.disable(gl.DEPTH_TEST);
|
||||||
|
//Restore GL parameters.
|
||||||
|
gl.depthMask(tmpDepthMask);
|
||||||
|
gl.depthFunc(tmpDepthFunc);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user