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.

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.