createProgram static method
Creates a shader program.
First creates a program then attatch the vertex and fragment shaders, links the program finally returns the program id.
Takes an OpenGl ES context, a vs vertex shader id, and a fs fragment shader id.
Finally returns the program id.
Implementation
static int createProgram(OpenGLContextES gl, int vs, int fs) {
int program = gl.createProgram();
gl.attachShader(program, vs);
gl.attachShader(program, fs);
gl.linkProgram(program);
gl.validateProgram(program);
gl.deleteShader(vs);
gl.deleteShader(fs);
var success = gl.getProgramParameter(program, gl.LINK_STATUS);
if (success != 0) {
return program;
}
print('getProgramInfoLog: ${gl.getProgramInfoLog(program)}');
gl.deleteProgram(program);
throw 'failed to create the program';
}