Merge pull request #27 from elemoine/webgl-point-texture-coords

Fix texture coordinates in WebGL image replay
This commit is contained in:
Éric Lemoine
2014-11-10 13:05:38 +01:00
+17 -13
View File
@@ -286,46 +286,50 @@ ol.render.webgl.ImageReplay.prototype.drawCoordinates_ =
n = numVertices / 8; n = numVertices / 8;
// bottom-left corner
offsetX = -scale * anchorX; offsetX = -scale * anchorX;
offsetY = -scale * (height - anchorY); offsetY = -scale * (height - anchorY);
this.vertices_[numVertices++] = x; this.vertices_[numVertices++] = x;
this.vertices_[numVertices++] = y; this.vertices_[numVertices++] = y;
this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; this.vertices_[numVertices++] = offsetX * cos - offsetY * sin;
this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; this.vertices_[numVertices++] = offsetX * sin + offsetY * cos;
this.vertices_[numVertices++] = originX / imageWidth;
this.vertices_[numVertices++] = (originY + height) / imageHeight;
this.vertices_[numVertices++] = opacity;
this.vertices_[numVertices++] = rotateWithView;
// bottom-right corner
offsetX = scale * (width - anchorX);
offsetY = -scale * (height - anchorY);
this.vertices_[numVertices++] = x;
this.vertices_[numVertices++] = y;
this.vertices_[numVertices++] = offsetX * cos - offsetY * sin;
this.vertices_[numVertices++] = offsetX * sin + offsetY * cos;
this.vertices_[numVertices++] = (originX + width) / imageWidth; this.vertices_[numVertices++] = (originX + width) / imageWidth;
this.vertices_[numVertices++] = (originY + height) / imageHeight; this.vertices_[numVertices++] = (originY + height) / imageHeight;
this.vertices_[numVertices++] = opacity; this.vertices_[numVertices++] = opacity;
this.vertices_[numVertices++] = rotateWithView; this.vertices_[numVertices++] = rotateWithView;
offsetX = scale * (width - anchorX); // top-right corner
offsetY = -scale * (height - anchorY);
this.vertices_[numVertices++] = x;
this.vertices_[numVertices++] = y;
this.vertices_[numVertices++] = offsetX * cos - offsetY * sin;
this.vertices_[numVertices++] = offsetX * sin + offsetY * cos;
this.vertices_[numVertices++] = originX / imageWidth;
this.vertices_[numVertices++] = (originY + height) / imageHeight;
this.vertices_[numVertices++] = opacity;
this.vertices_[numVertices++] = rotateWithView;
offsetX = scale * (width - anchorX); offsetX = scale * (width - anchorX);
offsetY = scale * anchorY; offsetY = scale * anchorY;
this.vertices_[numVertices++] = x; this.vertices_[numVertices++] = x;
this.vertices_[numVertices++] = y; this.vertices_[numVertices++] = y;
this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; this.vertices_[numVertices++] = offsetX * cos - offsetY * sin;
this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; this.vertices_[numVertices++] = offsetX * sin + offsetY * cos;
this.vertices_[numVertices++] = originX / imageWidth; this.vertices_[numVertices++] = (originX + width) / imageWidth;
this.vertices_[numVertices++] = originY / imageHeight; this.vertices_[numVertices++] = originY / imageHeight;
this.vertices_[numVertices++] = opacity; this.vertices_[numVertices++] = opacity;
this.vertices_[numVertices++] = rotateWithView; this.vertices_[numVertices++] = rotateWithView;
// top-left corner
offsetX = -scale * anchorX; offsetX = -scale * anchorX;
offsetY = scale * anchorY; offsetY = scale * anchorY;
this.vertices_[numVertices++] = x; this.vertices_[numVertices++] = x;
this.vertices_[numVertices++] = y; this.vertices_[numVertices++] = y;
this.vertices_[numVertices++] = offsetX * cos - offsetY * sin; this.vertices_[numVertices++] = offsetX * cos - offsetY * sin;
this.vertices_[numVertices++] = offsetX * sin + offsetY * cos; this.vertices_[numVertices++] = offsetX * sin + offsetY * cos;
this.vertices_[numVertices++] = (originX + width) / imageWidth; this.vertices_[numVertices++] = originX / imageWidth;
this.vertices_[numVertices++] = originY / imageHeight; this.vertices_[numVertices++] = originY / imageHeight;
this.vertices_[numVertices++] = opacity; this.vertices_[numVertices++] = opacity;
this.vertices_[numVertices++] = rotateWithView; this.vertices_[numVertices++] = rotateWithView;