Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 4x | export default function loadProgram( gl: WebGLRenderingContext, shaders: WebGLShader[], attribs: string[] = [], locations?: number[], error?: (err: Error) => void ): WebGLProgram | undefined { const program = gl.createProgram(); if (program !== null) { // Load shaders and attributes shaders.forEach(shader => gl.attachShader(program, shader)); attribs.forEach((attrib, i) => gl.bindAttribLocation(program, locations ? locations[i] : i, attrib) ); gl.linkProgram(program); // Check the link status const linked = gl.getProgramParameter(program, gl.LINK_STATUS); if (!linked) { if (error) { error( new Error( `Error in program linking: ${gl.getProgramInfoLog(program)}` ) ); } gl.deleteProgram(program); return undefined; } return program; } return undefined; } |