shader.frag 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* License Notice:
  2. **
  3. ** This program is free software: you can redistribute it and/or modify
  4. ** it under the terms of the GNU General Public License as published by
  5. ** the Free Software Foundation, either version 3 of the License, or
  6. ** (at your option) any later version.
  7. ** This program is distributed in the hope that it will be useful,
  8. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ** GNU General Public License for more details.
  11. ** You should have received a copy of the GNU General Public License
  12. ** along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. */
  14. /**
  15. * @file shader.frag
  16. * @author TooOld2Rock'nRoll
  17. * @date 2022/Ago
  18. * @remark Last modified in 2023/Jul
  19. *
  20. * @brief Fragment Shader program for the ArcadeFighter library.
  21. *
  22. * Originally this code was part of Breakout, now part of ArcadeFighter library
  23. * and was modified by the author as a exercise.<br>
  24. * Breakout is free software: you can redistribute it and/or modify
  25. * it under the terms of the CC BY 4.0 license as published by
  26. * Creative Commons, either version 4 of the License, or (at your
  27. * option) any later version.
  28. *
  29. * @see https://learnopengl.com/Getting-started/Shaders
  30. * @see https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language
  31. * @see https://www.khronos.org/opengl/wiki/Fragment_Shader
  32. *
  33. * @todo give another try at chroma key (solid color for transparency), opengl does not like this!
  34. */
  35. //The minimum version of OpenGl that this program supports.
  36. #version 330 core
  37. in vec2 TexCoords; ///< which point (pixels don't quite make sense here) of the texture to render.
  38. out vec4 FragColor; ///< forward the color to render the fragment.
  39. uniform sampler2D image; ///< the texture
  40. uniform vec4 color; ///< color tint to apply over the texture
  41. /**
  42. * @brief The main method of the Fragment Shader.
  43. */
  44. void main ()
  45. {
  46. FragColor = color * texture(image, TexCoords);
  47. }//END main ()