Skip to content

Instantly share code, notes, and snippets.

@Shaptic
Created November 14, 2012 01:44
Show Gist options
  • Save Shaptic/4069709 to your computer and use it in GitHub Desktop.
Save Shaptic/4069709 to your computer and use it in GitHub Desktop.
Basic vertex shader.
#version 330
// Input from program: vertex, texture coordinates,
// and color.
//
// In IronClad, these are part of a vertex2_t struct
// that is passed to the VBO after being loaded with
// mesh data.
smooth in vec2 vs_vertex;
smooth in vec2 vs_texc;
smooth in vec4 vs_color;
// Projection and model-view (basically position) matrices.
uniform mat4 proj;
uniform mat4 mv;
// To fragment shader, color and texture coordinates.
smooth out vec4 fs_color;
smooth out vec2 fs_texc;
void main()
{
gl_Position = proj * mv * vec4(vs_vertex, 1.0, 1.0);
fs_color = vs_color;
fs_texc = vs_texc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment