Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. //vertex shader
  2. #version 140
  3. in int p; //dummy input
  4. out vec2 t; //finicky output
  5. void main() {
  6. p; // line in question
  7. vec2 pos;
  8. vec4 st = vec4(-2.5, 2.5, 0.0, 5); //const values
  9. if (gl_VertexID == 0) { pos.x = st.x; pos.y = st.z; t.x = 1; t.y = 1;}
  10. else if (gl_VertexID == 1) { pos.x = st.x; pos.y = st.w; t.x = 1; t.y = 0;}
  11. else if (gl_VertexID == 2) { pos.x = st.y; pos.y = st.z; t.x = 0; t.y = 1;}
  12. else if (gl_VertexID == 3) { pos.x = st.y; pos.y = st.w; t.x = 0; t.y = 0;}
  13. gl_Position = gl_ModelViewProjectionMatrix * vec4( pos, 0.0, 1.0 );
  14. }
  15. //fragment shader
  16. #version 140
  17. uniform sampler2D tex;
  18. in vec2 t;
  19. void main() {
  20. gl_FragColor = texture2D(tex, t);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement