Progmar Marcin Załęczny

We are using cookies in the page. If you use the page you agree for the cookies.      Close

Grayscale with OpenGL

Example of how to convert coloured RGBA picture into grayscale one. Program demonstrates to ways of conversion:

  • first is using average formula: color = (color.r + color.g + color.b) / 3.0
  • second is standard using following formula: color = 0.299 * color.r + 0.587 * color.g + 0.114 * color.b
All convertion takes place in fragment shader.