Spherical conversion vertex shader

hi,

i need help on glsl. im trying to get each vertex on vertex shader and give the spherical value to fragment shader.

what i want to do is:

  1. get the light position
  2. get the vertex position
  3. calculate the direction from vertex to light, and normalize, resulting cartesian coordinate vec3
  4. find the spherical value from the cartesian coordinate. notice the r in spherical coordinate is set to 1 since its normalize.
  5. find the index, this step does not really matter since its my program logic.

here is the code:
http://pastebin.com/MNXN6EZg

nothing appear on the screen. did i do anything wrong? thanks.

Start with shaders that display, and modify gradually as you get comfortable with shaders. E.g.:

vert: void main(void){gl_Position=ftransform();
frag: void main(void){gl_FragColor=vec4(1,1,1,1);}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.