createShader static method
Creates shader.
glthe OpenGlES context.typethe shader type.gl.VERTEX_SHADERgl.FRAGMENT_SHADER
sourcethe shader source
Implementation
static int createShader(OpenGLContextES gl, int type, String source) {
int shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
if (success == 0 || success == false) {
print("Error compiling shader: " + gl.getShaderInfoLog(shader));
throw 'Failed to create the shader';
}
return shader;
}