From c0acc8d82568bb293fa351b0ef5df67dd9334c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 7 Nov 2014 09:59:56 +0100 Subject: [PATCH] Add comment describing the vertices sent to GPU --- src/ol/render/webgl/webglreplay.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ol/render/webgl/webglreplay.js b/src/ol/render/webgl/webglreplay.js index 9a6ac203a0..d698d7645f 100644 --- a/src/ol/render/webgl/webglreplay.js +++ b/src/ol/render/webgl/webglreplay.js @@ -265,9 +265,17 @@ ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = x = flatCoordinates[i] - this.origin_[0]; y = flatCoordinates[i + 1] - this.origin_[1]; - n = numVertices / 8; + // There are 4 vertices per [x, y] point, one for each corner of the + // rectangle we're going to draw. We'd use 1 vertex per [x, y] point if + // WebGL supported Geometry Shaders (which can emit new vertices), but that + // is not currently the case. + // + // And each vertex includes 8 values: the x and y coordinates, the x and + // y offsets used to calculate the position of the corner, the u and + // v texture coordinates for the corner, the opacity, and whether the + // the image should be rotated with the view (rotateWithView). - // 4 vertices per coordinate, with 8 values per vertex + n = numVertices / 8; offsetX = -scale * anchorX; offsetY = -scale * (height - anchorY);