Are there any alternatives to the ddx and ddy functions so I can use them in OpenGL? dfdx and dfdy appear not to be implemented.
ddx and ddy work fine
sure you set the pragmas right? I think the shader model 3 pragma is required for ddx and ddy isn’t it?
The only way I can get ddx and ddy to work is if I set it to DirectX only pragma. Requiring shader model 3.0 did not help
~edit~
ddx ddy should be supported in 2.x + (according to MSDN)
As I understand it, those functions aren’t implemented by Apple’s OpenGL drivers.
Are there any alternatives? What sort of algorithm do they use?
The functions use the parallel nature of the GPU to calculate the slope of a function across the whole screen simultaneously. You can’t do that with regular old per-fragment math, but here is a way to emulate it using trilinear filtering.