File: vertex.glsl

package info (click to toggle)
libopengl-perl 0.66%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,932 kB
  • sloc: perl: 9,796; ansic: 6,279; makefile: 101; sh: 48
file content (23 lines) | stat: -rw-r--r-- 467 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
uniform vec4 center;
uniform mat4 xform;

void main(void)
{
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  gl_Position *= xform;

  // Calc texcoord values
  vec4 pos = gl_Vertex;
  float d = sqrt(pos.x * pos.x + pos.y * pos.y);
  float a = atan(pos.x/pos.y) / 3.1415;
  if (a < 0.0) a += 1.0;
  a *= 2.0;
  a -= float(int(a));

  pos -= center;
  float h = pos.z;
  h = abs(2.0 * atan(h/d) / 3.1415);

  gl_TexCoord[0].x = a;
  gl_TexCoord[0].y = h;
}