webgl-operate icon indicating copy to clipboard operation
webgl-operate copied to clipboard

Bad example code for Program?

Open bwasty opened this issue 6 years ago • 0 comments

This example doesn't seem to work as it is: https://github.com/cginternals/webgl-operate/blob/fa0035e100ec728e964478ea0d694996f861b8ec/source/program.ts#L15-L17

Instead this works:

const vert = new Shader(this._context, gl.VERTEX_SHADER, 'testrenderer.vert');
vert.initialize(require('./testrenderer.vert'));
const frag = new Shader(this._context, gl.FRAGMENT_SHADER, 'testrenderer.frag');
frag.initialize(require('./testrenderer.frag'));

this._program = new Program(this._context);
this._program.initialize([vert, frag]);

Side remark: from the rest of doc page it's unclear why you would call initialize with these args (has a generic description and ...args: any[] since it's only inherited). create and attach on the other hand look like more reasonable choices.

bwasty avatar Apr 22 '18 06:04 bwasty