Search code examples
javascriptgoogle-chromethree.jsshader

Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs


I want to build a custom shader which will not be rendered. I mean I want to tell fragment shader not to write anything. So, on fragment shader I am not setting gl_FragColor.

The program works well on Firefox and Edge but not working on Chrome. On Chrome has warning: "GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs."

Can you help me to solve this problem on Chrome? Is there any settings to accept shader without fragment?

vertexShader:

  void main() 
  {
    vec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);
    gl_Position = projectionMatrix * modelViewPosition;
  }

fragmentShader:

  void main() {
    return;
  }

Solution

  • It seems you can avoid this warning by setting Material.colorWrite to false. This will tell WebGL to disable all color components when your custom shader material is used for rendering.

    three.js R107