Skip to content

Commit

Permalink
triangle rendered succefully, but gl.bindBuffer & gl.vertexAttribPoin…
Browse files Browse the repository at this point in the history
…ter not clear
  • Loading branch information
Plasmatium committed Dec 21, 2017
1 parent 003312e commit 403100f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/collection/utils/WebGL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TransferParam } from "./others";

export class GLProg {
public program: WebGLProgram
public attrLocs: { [variableName: string]: number }
public attrLocs: { [variableName: string]: number } = {}
constructor (vsSrc: string, fsSrc: string, protected gl: WebGLRenderingContext) {
this.makeProgram(vsSrc, fsSrc)
}
Expand Down Expand Up @@ -57,14 +57,14 @@ export class GLProg {
let {gl} = this
let attrLoc = this.attrLocs[attrName]
gl.enableVertexAttribArray(attrLoc)
gl.bindBuffer(gl.ARRAY_BUFFER, attrLoc)
// gl.bindBuffer(gl.ARRAY_BUFFER, buffer)
gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset)
}
}

export abstract class GLScene {
protected glPrograms: { [progName: string]: GLProg }
protected bufferPool: { [bufferName: string]: WebGLBuffer }
protected glPrograms: { [progName: string]: GLProg } = {}
protected bufferPool: { [bufferName: string]: WebGLBuffer } = {}
public canvas: HTMLCanvasElement
public gl: WebGLRenderingContext
timer: number
Expand Down

0 comments on commit 403100f

Please sign in to comment.