opengl es 2.0 - iOS Simulator GL_OES_standard_derivatives -
on ios4 gl_oes_standard_derivatives supported on device (from see when output extensions), there way able to:
detect in fragment shader if extension supported or not
if not supported, have code dfdx , dfdy? can't seems find on google.
tia!
i had same issue antialiasing sdm fonts. can calculate similar dfdx/dfdx translating 2 2d vectors using current transform matrix :
vec2 p1(0,0); vec2 p2(1,1); p1=transformusingcurrentmatrix(p1); p2=transformusingcurrentmatrix(p2); float magic=35; // you'll need play - it's linked screen size think :p float dfdx=(p2.x-p1.x)/magic; float dfdy=(p2.y-p1.y)/magic;
then send dfdx/dfdy shader uniforms - , multiply parameter same functionality i.e.
dfdx(myval)
becomes
dfdx*myval; dfdy(myval) dfdy*myval; fwidth(myval) abs(dfdx*myval)+abs(dfdy*myval);
Comments
Post a Comment