Skip to content

Instantly share code, notes, and snippets.

@mosra
Created May 7, 2012 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosra/2629906 to your computer and use it in GitHub Desktop.
Save mosra/2629906 to your computer and use it in GitHub Desktop.
Attribute-less vertex shader
#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