Created
May 7, 2012 19:42
-
-
Save mosra/2629906 to your computer and use it in GitHub Desktop.
Attribute-less vertex shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 330 | |
uniform mat4 transformationMatrix; | |
uniform mat4 projectionMatrix; | |
out vec2 texCoord; | |
const vec2 data[4] = vec2[]( | |
vec2(-1.0, 1.0), | |
vec2(-1.0, -1.0), | |
vec2( 1.0, 1.0), | |
vec2( 1.0, -1.0) | |
); | |
void main() { | |
/* Texture coordinate */ | |
texCoord = (data[gl_VertexID]+vec2(1.0))/2; | |
/* Position */ | |
gl_Position = projectionMatrix*transformationMatrix*vec4(data[gl_VertexID], 0.0, 1.0).xzyw; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment