Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //vertex shader
- #version 140
- in int p; //dummy input
- out vec2 t; //finicky output
- void main() {
- p; // line in question
- vec2 pos;
- vec4 st = vec4(-2.5, 2.5, 0.0, 5); //const values
- if (gl_VertexID == 0) { pos.x = st.x; pos.y = st.z; t.x = 1; t.y = 1;}
- else if (gl_VertexID == 1) { pos.x = st.x; pos.y = st.w; t.x = 1; t.y = 0;}
- else if (gl_VertexID == 2) { pos.x = st.y; pos.y = st.z; t.x = 0; t.y = 1;}
- else if (gl_VertexID == 3) { pos.x = st.y; pos.y = st.w; t.x = 0; t.y = 0;}
- gl_Position = gl_ModelViewProjectionMatrix * vec4( pos, 0.0, 1.0 );
- }
- //fragment shader
- #version 140
- uniform sampler2D tex;
- in vec2 t;
- void main() {
- gl_FragColor = texture2D(tex, t);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement