[osg-users] Varying shader variable /= 0 in vertex shader, is == 0 in fragment shader

2008-11-03 Thread Engvall ├ůsa
Hi osg-users! I'm trying to write my first shader, it is a very simple test program which sets the color on a sphere. The color depends on whether the sphere has moved relative to its position in the previous frame. I use two varying variables, which are set in the vertex shader, see the code

Re: [osg-users] Varying shader variable /= 0 in vertex shader, is == 0 in fragment shader

2008-11-03 Thread Andreas Lindmark
This line: vec2 displacementNDC = currentPosClip.xy/currentPosClip.w - previousPosClip.xy/previousPosClip.w; should be displacementNDC = currentPosClip.xy/currentPosClip.w - previousPosClip.xy/previousPosClip.w; Otherwise you will be declaring a new variable with the name displacementNDC the main