// GL Shading Language version 1.0 Vertex Shader // Orion Sky Lawlor, olawlor@acm.org, 2006/08/31 (Public Domain) // C++/vertex shader interface uniform float spin_x, spin_y; // Vertex/fragment shader interface: varying vec4 color; // Material diffuse color // Input: gl_Vertex. Output: gl_Position. void main(void) { // Vertex positions come from the C program: vec4 v = gl_Vertex; float angle=spin_x; float s=sin(angle), c=cos(angle); mat4 m=mat4(0.0); m[0].x=c; m[1].x=-s; m[0].y=s; m[1].y=c; m[2].z=1.0; m[2].w=1.0; m[3].w=2.0; /* w= z+2.0 */ gl_Position = m*v; // gl_Position is where onscreen the vertex will be drawn. // We'll set color the same as input position color=gl_Vertex; }