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); }
ChangeFace(value) { switch(value) { default: case '0': this.gl.enable(this.gl.CULL_FACE); this.gl.cullFace(this.gl.BACK); break; case '1': this.gl.enable(this.gl.CULL_FACE); this.gl.cullFace(this.gl.FRONT); break; case '2': this.gl.enable(this.gl.CULL_FACE); this.gl.cullFace(this.gl.FRONT_AND_BACK); break; case '3': this.gl.disable(this.gl.CULL_FACE); break; } }