I haven't usel GLSL for a while. And now I have a problem with dFdx/dFdy.
I need the derivative of the texturecoordinates in order to implement an algorithm.
I use the OpenGL shader builder, which comes with Mac os x; however for the plane and torus example the results are pretty good for the teapot and the sphere the results are very poor. I think it is because the latter examples have a very low resolution.
Now my question:
I thought for a varying variable dFdx/y should give the interpolated values (like figure 17.5 http://www.yaldex.com/open-gl/ch17lev1sec4.html). But, If I have a look only at the absolute value of the dFdx funktion output, this doesn't seem interpolated.
Did I missunderstand something? Or is there an error in the use of the dFdx funktion.
Sorry, I had had a look in the internet but couldn't find a solution and it is a very tiny code snipet maybe someone can help me.
Fragmentshader:
int texSizeX = 256;void main(){ float dsx = abs(dFdx(gl_TexCoord[0].s * float(texSizeX))); gl_FragColor = vec4(dsx,0.0,0.0,1.0);}
Thanks