From f9f3da7048880cb3c4b03d0116bb8be850688e74 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 23 Oct 2018 23:45:30 +0200 Subject: Update everything --- src/view/Renderer.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/view/Renderer.ts b/src/view/Renderer.ts index 1b9dd84..f1b7bac 100644 --- a/src/view/Renderer.ts +++ b/src/view/Renderer.ts @@ -1,14 +1,18 @@ import {mat4} from 'gl-matrix'; +import vertexShaderSrc from './default.vs'; +import fragmentShaderSrc from './default.fs'; + + export default class Renderer { public gl: WebGLRenderingContext; - public vertexPosLoc: number; - public textureCoordLoc: number; - private viewportLoc: WebGLUniformLocation; - private translateLoc: WebGLUniformLocation; - public samplerLoc: WebGLUniformLocation; + public vertexPosLoc!: number; + public textureCoordLoc!: number; + private viewportLoc!: WebGLUniformLocation; + private translateLoc!: WebGLUniformLocation; + public samplerLoc!: WebGLUniformLocation; private viewport: mat4 = mat4.create(); @@ -66,8 +70,8 @@ export default class Renderer { if (!shaderProgram) throw new Error('Unable to create shader program'); - let vertexShader = this.compileShader(this.gl.VERTEX_SHADER, require('./default.vs')); - let fragmentShader = this.compileShader(this.gl.FRAGMENT_SHADER, require('./default.fs')); + let vertexShader = this.compileShader(this.gl.VERTEX_SHADER, vertexShaderSrc); + let fragmentShader = this.compileShader(this.gl.FRAGMENT_SHADER, fragmentShaderSrc); this.gl.attachShader(shaderProgram, vertexShader); -- cgit v1.2.3