Advertisement
weeez

shader ogl

Mar 2nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ------------------ BasicVertexShader ------------------
  2.  
  3. #version 100
  4. precision mediump float;
  5.  
  6. attribute vec4 a_Position;
  7. attribute vec2 a_TexCoord;
  8. uniform mat4 worldMatrix;
  9.  
  10. varying vec2 v_TexCoord;
  11.  
  12. void main()
  13. {
  14.     v_TexCoord = a_TexCoord;
  15.  
  16.     vec4 inPos = vec4(a_Position.xyz, 1.0);
  17.  
  18.     gl_Position = worldMatrix * inPos;
  19. }
  20.  
  21. // ------------------ BasicPixelShader ------------------
  22.  
  23. #version 100
  24. precision mediump float;
  25.  
  26. varying vec4 v_Color;
  27. varying vec2 v_TexCoord;
  28.  
  29. uniform sampler2D u_Texture;
  30.  
  31.  
  32. void main()
  33. {
  34.     vec4 sampledColor = texture2D(u_Texture, v_TexCoord);
  35.     gl_FragColor = sampledColor;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement