this.gl.enable(this.gl.DEPTH_TEST);
this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
attribute vec4 vPosition; attribute vec3 vBC; attribute vec4 vColor;
uniform int vShader;
this.shaderLoc = this.gl.getUniformLocation(this.program, "vShader");
this.gl.uniform1i(this.shaderLoc, this.shaderChoice);
// shader uniform mat4 uMatrix1; // in the js code, let mat1Pos = gl.getUniformLocation(program, "uMatrix1"); let a = translate(0.25, 0.25, 0.0); gl.uniformMatrix4fv(mat1Pos, false, flatten(a));
// filled with edge shader
void Shader0() {
if (any(lessThan(f_BC, vec3(0.005)))) {
// edge, draw it with the edge color
gl_FragColor= e_Color;
} else {
if (gl_FrontFacing) {
// front face, draw it with the face color
gl_FragColor = f_Color;
} else {
// back face, draw it grey
gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);
}
}
}