Add shutdown methods to replays

This commit is contained in:
GaborFarkas
2016-10-05 10:14:30 +02:00
parent 360e77481d
commit 5cf2e9c072
4 changed files with 43 additions and 5 deletions
+12
View File
@@ -449,6 +449,18 @@ ol.render.webgl.ImageReplay.prototype.setUpProgram = function(gl, context, size,
};
/**
* @inheritDoc
*/
ol.render.webgl.ImageReplay.prototype.shutDownProgram_ = function(gl, locations) {
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);
};
/**
* @inheritDoc
*/
@@ -472,6 +472,17 @@ ol.render.webgl.LineStringReplay.prototype.setUpProgram = function(gl, context,
};
/**
* @inheritDoc
*/
ol.render.webgl.LineStringReplay.prototype.shutDownProgram_ = function(gl, locations) {
gl.disableVertexAttribArray(locations.a_lastPos);
gl.disableVertexAttribArray(locations.a_position);
gl.disableVertexAttribArray(locations.a_nextPos);
gl.disableVertexAttribArray(locations.a_direction);
};
/**
* @inheritDoc
*/
@@ -848,6 +848,14 @@ ol.render.webgl.PolygonReplay.prototype.setUpProgram = function(gl, context, siz
};
/**
* @inheritDoc
*/
ol.render.webgl.PolygonReplay.prototype.shutDownProgram_ = function(gl, locations) {
gl.disableVertexAttribArray(locations.a_position);
};
/**
* @inheritDoc
*/
+12 -5
View File
@@ -143,6 +143,17 @@ ol.render.webgl.Replay.prototype.setUpProgram = function(gl, context, size, pixe
* @abstract
* @protected
* @param {WebGLRenderingContext} gl gl.
* @param {ol.render.webgl.imagereplay.defaultshader.Locations|
ol.render.webgl.linestringreplay.defaultshader.Locations|
ol.render.webgl.polygonreplay.defaultshader.Locations} locations Locations.
*/
ol.render.webgl.Replay.prototype.shutDownProgram_ = function(gl, locations) {};
/**
* @abstract
* @private
* @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip.
@@ -286,11 +297,7 @@ ol.render.webgl.Replay.prototype.replay = function(context,
}
// disable the vertex attrib arrays
for (var i in locations) {
if (typeof locations[i] === 'number') {
gl.disableVertexAttribArray(locations[i]);
}
}
this.shutDownProgram_(gl, locations);
if (this.lineStringReplay) {
this.lineStringReplay.replay(context,