mirror of
https://github.com/photonstorm/phaser
synced 2025-02-18 15:08:31 +00:00
Use this.x, this.y as scrolling offsets when rendering each tile.
This commit is contained in:
parent
69abe492cc
commit
ef4143136e
1 changed files with 2 additions and 1 deletions
|
@ -270,7 +270,8 @@ PIXI.Tilemap.prototype._renderTile = function(gl, shader, x, y, tile)
|
||||||
gl.bufferData( gl.ARRAY_BUFFER, this.buffer, gl.STATIC_DRAW );
|
gl.bufferData( gl.ARRAY_BUFFER, this.buffer, gl.STATIC_DRAW );
|
||||||
gl.vertexAttribPointer( shader.aPosition, 4, gl.FLOAT, false, 0, 0 );
|
gl.vertexAttribPointer( shader.aPosition, 4, gl.FLOAT, false, 0, 0 );
|
||||||
|
|
||||||
gl.uniform2f(shader.uScreenPosition, x, y);
|
// draw the tile after applying the base coordinates (scrolling offset)
|
||||||
|
gl.uniform2f(shader.uScreenPosition, x - this.x, y - this.y);
|
||||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue