摘自:http://stackoverflow.com/questions/2508818/how-to-debug-a-glsl-shader
void main(){ float bug=0.0; vec3 tile=texture2D(colMap, coords.st).xyz; vec4 col=vec4(tile, 1.0); if(something) bug=1.0; col.x+=bug; gl_FragColor=col; }
It is a debugging device. If you want to know where the light position is in
the scene, for example, go: if(lpos.x>100) bug=1.0. If the light position is greater than 100, the scene will turn red.– ste3e