Fire WebGL precompose event in same sequence as other renderers

In other map renderers, the precompose event is fired before preparing and
composing layer frames. In WebGL, it is fired in between. This change makes
it so the sequence of events is the same for all renderers.

Because the WebGL renderer creates the list of layers to render before the
precompose event, unmanaged layers are never rendered. This is also fixed
by dispatching the precompose event earlier.
This commit is contained in:
Andreas Hocevar
2015-07-11 14:58:31 +02:00
parent afce912f11
commit ac8e62818f

View File

@@ -467,6 +467,8 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
this.textureCache_.set((-frameState.index).toString(), null);
++this.textureCacheFrameMarkerCount_;
this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState);
/** @type {Array.<ol.layer.LayerState>} */
var layerStatesToDraw = [];
var layerStatesArray = frameState.layerStatesArray;
@@ -499,8 +501,6 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
gl.enable(goog.webgl.BLEND);
gl.viewport(0, 0, this.canvas_.width, this.canvas_.height);
this.dispatchComposeEvent_(ol.render.EventType.PRECOMPOSE, frameState);
for (i = 0, ii = layerStatesToDraw.length; i < ii; ++i) {
layerState = layerStatesToDraw[i];
layerRenderer = this.getLayerRenderer(layerState.layer);