Guest User

Untitled

a guest
Jul 22nd, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. GLSL shader that scroll texture
  2. /*VERTEX_PROGRAM*/
  3.  
  4. in vec4 in_Vertex;
  5. in vec4 in_TexCoord;
  6.  
  7. uniform mat4 ModelViewMatrix;
  8. uniform mat4 ProjectionMatrix;
  9.  
  10. out vec2 TexCoord;
  11.  
  12. void main()
  13. {
  14. gl_Position = ProjectionMatrix * ModelViewMatrix * in_Vertex;
  15.  
  16. TexCoord = vec2( in_TexCoord );
  17. }
  18.  
  19. /*FRAGMENT_PROGRAM*/
  20.  
  21. in vec2 TexCoord;
  22.  
  23. uniform sampler2D Texture0;
  24.  
  25. /// Updated in external code
  26. uniform float Time;
  27.  
  28. out vec4 out_FragColor;
  29.  
  30. void main()
  31. {
  32. /// "u" coordinate is altered
  33. out_FragColor = texture( Texture0, vec2(TexCoord.x + Time, TexCoord.y) );
  34. }
Advertisement
Add Comment
Please, Sign In to add comment