Avoid calling render() too early

This commit is contained in:
Tom Payne
2012-08-16 18:26:59 +02:00
parent 44cd3ceccb
commit 5a9fe22e8c

View File

@@ -232,7 +232,7 @@ ol.webgl.MapRenderer = function(target, map) {
*/
this.layerRendererChangeListenKeys_ = {};
this.handleWebGLContextRestored();
this.initializeGL_();
};
goog.inherits(ol.webgl.MapRenderer, ol.MapRenderer);
@@ -495,13 +495,21 @@ ol.webgl.MapRenderer.prototype.handleWebGLContextRestored = function() {
if (goog.DEBUG) {
ol.webgl.map.logger.info('WebGLContextRestored');
}
this.initializeGL_();
this.getMap().render();
};
/**
* @private
*/
ol.webgl.MapRenderer.prototype.initializeGL_ = function() {
var gl = this.gl_;
gl.activeTexture(goog.webgl.TEXTURE0);
gl.blendFunc(goog.webgl.SRC_ALPHA, goog.webgl.ONE_MINUS_SRC_ALPHA);
gl.disable(goog.webgl.CULL_FACE);
gl.disable(goog.webgl.DEPTH_TEST);
gl.disable(goog.webgl.SCISSOR_TEST);
this.render();
};