PDA

View Full Version : spherical conversion vertex shader



jos_t_tarigan
06-15-2010, 02:31 PM
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.

Dark Photon
06-15-2010, 04:56 PM
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);}