Improve algorithm for finding framebuffer size

This commit is contained in:
Tom Payne
2012-08-06 00:00:38 +02:00
parent 71c659396d
commit bf6705a80d

View File

@@ -269,11 +269,8 @@ ol.webgl.TileLayerRenderer.prototype.render = function() {
var maxDimension = Math.max(
tileBoundsSize.width * tileSize.width,
tileBoundsSize.height * tileSize.height);
// FIXME find a better algorithms for rounding up to the next power of two
var framebufferDimension = Math.max(tileSize.width, tileSize.height);
while (framebufferDimension < maxDimension) {
framebufferDimension *= 2;
}
var framebufferDimension =
Math.pow(2, Math.ceil(Math.log(maxDimension) / Math.log(2)));
var nTilesX = framebufferDimension / tileSize.width;
var nTilesY = framebufferDimension / tileSize.height;
var framebufferTileBounds = new ol.TileBounds(