A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BuiltinShaders.cc 632B

12345678910111213141516171819202122232425262728293031
  1. #include "BuiltinShaders.h"
  2. namespace Cygnet {
  3. BuiltinShaders::BuiltinShaders():
  4. textureVertex(GlShader::Type::VERTEX, R"(
  5. attribute vec4 position;
  6. attribute vec2 texCoord;
  7. varying vec2 v_texCoord;
  8. void main() {
  9. gl_Position = position;
  10. v_texCoord = texCoord;
  11. }
  12. )"),
  13. textureFragment(GlShader::Type::FRAGMENT, R"(
  14. precision mediump float;
  15. varying vec2 v_texCoord;
  16. uniform sampler2D tex;
  17. void main() {
  18. gl_FragColor = texture2D(tex, v_texCoord);
  19. }
  20. )"),
  21. whiteFragment(GlShader::Type::FRAGMENT, R"(
  22. precision mediump float;
  23. void main() {
  24. gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
  25. }
  26. )") {}
  27. }