现在的位置: 首页 > 综合 > 正文

How to debug a GLSL shader?

2019年01月07日 ⁄ 综合 ⁄ 共 379字 ⁄ 字号 评论关闭

摘自: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

抱歉!评论已关闭.