Advertisement
dragonlux

Psychedelic Shader

Dec 17th, 2018
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //VertexShaders.h
  2.  
  3. const char* vertexShaderSource =
  4. "#version 330 core\n"
  5. "layout(location = 0) in vec3 aPos;\n"
  6. "layout(location = 1) in vec3 aColor;\n"
  7. "layout(location = 2) in vec2 aTexCoord;\n"
  8. "out vec3 ourColor;\n"
  9. "out vec2 TexCoord;\n"
  10. "uniform mat4 u_proj;\n"
  11. "uniform mat4 u_view;\n"
  12. "uniform mat4 u_model;\n"
  13. "void main()\n"
  14. "{\n"
  15. "gl_Position = u_proj * u_view * u_model * vec4(aPos, 1.0);\n"
  16. "ourColor = aColor;\n"
  17. "TexCoord = aTexCoord;\n"
  18. "}\n";
  19.  
  20.  
  21. //FragmentShaders.h
  22.  
  23. const char* fragmentShaderSource =
  24. "#version 330 core\n"
  25. "out vec4 FragColor;\n"
  26. "in vec3 ourColor;\n"
  27. "in vec2 TexCoord;\n"
  28. "uniform sampler2D ourTexture;\n"
  29. "void main()\n"
  30. "{\n"
  31. "FragColor = texture(ourTexture, TexCoord) * vec4(ourColor, 1.0);\n"
  32. "}\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement