Merge pull request #46 from elemoine/webgl-point-delete-resources
[webgl-point] Delete WebGL resources
This commit is contained in:
@@ -171,11 +171,12 @@ ol.render.webgl.Immediate.prototype.drawGeometryCollectionGeometry =
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawPointGeometry =
|
||||
function(pointGeometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = replayGroup.getReplay(0, ol.render.ReplayType.IMAGE);
|
||||
replay.setImageStyle(this.imageStyle_);
|
||||
replay.drawPointGeometry(pointGeometry, data);
|
||||
replay.finish(this.context_);
|
||||
replay.finish(context);
|
||||
// default colors
|
||||
var opacity = 1;
|
||||
var brightness = 0;
|
||||
@@ -185,6 +186,7 @@ ol.render.webgl.Immediate.prototype.drawPointGeometry =
|
||||
replay.replay(this.context_, this.center_, this.resolution_, this.rotation_,
|
||||
this.size_, this.extent_, this.pixelRatio_, opacity, brightness,
|
||||
contrast, hue, saturation, {});
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
|
||||
|
||||
@@ -212,11 +214,12 @@ ol.render.webgl.Immediate.prototype.drawMultiLineStringGeometry =
|
||||
*/
|
||||
ol.render.webgl.Immediate.prototype.drawMultiPointGeometry =
|
||||
function(multiPointGeometry, data) {
|
||||
var context = this.context_;
|
||||
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
|
||||
var replay = replayGroup.getReplay(0, ol.render.ReplayType.IMAGE);
|
||||
replay.setImageStyle(this.imageStyle_);
|
||||
replay.drawMultiPointGeometry(multiPointGeometry, data);
|
||||
replay.finish(this.context_);
|
||||
replay.finish(context);
|
||||
// default colors
|
||||
var opacity = 1;
|
||||
var brightness = 0;
|
||||
@@ -226,6 +229,7 @@ ol.render.webgl.Immediate.prototype.drawMultiPointGeometry =
|
||||
replay.replay(this.context_, this.center_, this.resolution_, this.rotation_,
|
||||
this.size_, this.extent_, this.pixelRatio_, opacity, brightness,
|
||||
contrast, hue, saturation, {});
|
||||
replay.getDeleteResourcesFunction(context)();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -638,6 +638,13 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context,
|
||||
gl.drawElements(goog.webgl.TRIANGLES, numItems, elementType, offsetInBytes);
|
||||
start = end;
|
||||
}
|
||||
|
||||
// disable the vertex attrib arrays
|
||||
gl.disableVertexAttribArray(locations.a_position);
|
||||
gl.disableVertexAttribArray(locations.a_offsets);
|
||||
gl.disableVertexAttribArray(locations.a_texCoord);
|
||||
gl.disableVertexAttribArray(locations.a_opacity);
|
||||
gl.disableVertexAttribArray(locations.a_rotateWithView);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -302,6 +302,7 @@ ol.renderer.webgl.Map.prototype.dispatchComposeEvent_ =
|
||||
replayGroup.replay(context, center, resolution, rotation, size, extent,
|
||||
pixelRatio, opacity, brightness, contrast, hue, saturation, {});
|
||||
}
|
||||
replayGroup.getDeleteResourcesFunction(context)();
|
||||
|
||||
vectorContext.flush();
|
||||
this.replayGroup = replayGroup;
|
||||
|
||||
Reference in New Issue
Block a user