Delete ImageReplay textures

This commit is contained in:
Éric Lemoine
2014-11-03 14:16:32 +01:00
parent 4534bb8861
commit 14d7f2a797
2 changed files with 40 additions and 3 deletions

View File

@@ -125,6 +125,30 @@ ol.render.webgl.ImageReplay = function(tolerance) {
};
/**
* @param {olx.FrameState} frameState Frame state.
* @param {ol.webgl.Context} context Context.
*/
ol.render.webgl.ImageReplay.prototype.deleteTextures =
function(frameState, context) {
frameState.postRenderFunctions.push(
goog.partial(
/**
* @param {WebGLRenderingContext} gl GL.
* @param {Array.<WebGLTexture>} textures Textures.
*/
function(gl, textures) {
if (!gl.isContextLost()) {
var i, ii;
for (i = 0, ii = textures.length; i < ii; ++i) {
gl.deleteTexture(textures[i]);
}
}
}, context.getGL(), this.textures_));
};
/**
* @inheritDoc
*/
@@ -472,6 +496,19 @@ ol.render.webgl.ReplayGroup = function(tolerance) {
};
/**
* @param {olx.FrameState} frameState Frame state.
* @param {ol.webgl.Context} context Context.
*/
ol.render.webgl.ReplayGroup.prototype.deleteTextures =
function(frameState, context) {
var replayKey;
for (replayKey in this.replays_) {
this.replays_[replayKey].deleteTextures(frameState, context);
}
};
/**
* @param {ol.webgl.Context} context Context.
*/