Skip to content

Shader compiler error with GrayScalePostProcessor example from docs #2357

Answered by mattjennings
mattjennings asked this question in Q&A
Discussion options

You must be logged in to vote

I managed to get it working by comparing to the color blind fragment shader and updating some of the syntax.

So I guess the example just needs to be updated! (I have no idea if this is the right way to do it - but it works!)

#version 300 es
precision mediump float;

// our texture
uniform sampler2D u_image;

// the texCoords passed in from the vertex shader.
in vec2 v_texcoord;

out vec4 fragColor;

void main() {
  vec4 tex = texture(u_image, v_texcoord);
  float avg = 0.2126 * tex.r + 0.7152 * tex.g + 0.0722 * tex.b;
  fragColor = vec4(avg, avg, avg, 1.0);
}

Replies: 1 comment 2 replies

Comment options

mattjennings
Jun 21, 2022
Collaborator Author

You must be logged in to vote
2 replies
@eonarheim
Comment options

@eonarheim
Comment options

Answer selected by eonarheim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants