PDA

View Full Version : 3D Texture on glsl



jos_t_tarigan
08-02-2010, 02:14 PM
hi,

im trying to make a 3D Texture on my program, but i would like to change the third coordinate based on the spherical position of the camera from the pixel. so imagine it runs each vertex on the vertex shader, the shaders calculate the direction between the vertex and the camera. based on the camera position, the index sent to fragment shader to decide the value of the third texture coordinate. here is the vertex shader:

http://pastebin.com/9i8Yt7tv

and here is the fragment shader:

http://pastebin.com/WQr9izMr

im not sure which part is wrong but i get the wrong effect not as i expected. i presume there's something wrong with the code but i cant figure out which one. can someone help me?

thanks in advance