diff options
Diffstat (limited to 'src/view/renderer')
-rw-r--r-- | src/view/renderer/Renderer.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/view/renderer/Renderer.ts b/src/view/renderer/Renderer.ts index 9358515..a0ecf41 100644 --- a/src/view/renderer/Renderer.ts +++ b/src/view/renderer/Renderer.ts @@ -45,6 +45,10 @@ export default class Renderer { return this.shaders.samplerLoc; } + public setTranslation(v: Float32List) { + this.gl.uniform2fv(this.shaders.translateLoc, v); + } + private mkContext(): WebGLRenderingContext { const gl = ( this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl') @@ -66,6 +70,6 @@ export default class Renderer { mat4.scale(this.viewport, this.viewport, [2 * 64 / w, -2 * 64 / h, 1.0]); this.gl.uniformMatrix4fv(this.shaders.viewportLoc, false, this.viewport); - this.gl.uniform2f(this.shaders.translateLoc, -5.0, -5.0); + this.setTranslation([-5, -5]); } } |