You are not handling samplerTransform or destCoord() properly and thus when the
Core Image Tiler is evoked your output coordinates are incorrect. Read up on
Region of Interest and Domain of Definition. You can usually just replace
samplerCoord(image) with samplerTransform(image, destCoord()). If you are using
the samplerCoord to do calculations, you then need to use destCoord().
Aha, that is indeed it.
Here is the fixed working CIKernel:
/* from cwright with love ;) */
kernel vec4 arc(sampler image, __color color, float majorRadius,
float minorRadius, float angle, float diameter)
{
angle *= 3.14159265358/360.; // degrees to radians
angle -= 3.14159265358/2.; // 0 to pi (empty to full)
float x = destCoord().x - diameter/2.;
float y = destCoord().y - diameter/2.;
float r = sqrt(x*x+y*y);
float theta = asin(y/r);
float majorRad = majorRadius * diameter/2.;
float minorRad = minorRadius * diameter/2.;
vec4 color1 = r > minorRad ? color : vec4(0.);
color1 *= r < majorRad ? 1. : 0.0;
color1 *= theta < angle ? 1. : 0.0;
return color1;
}
1800px squared is well within the limits of modern GPUs (some can handle 8k
textures) :)
On Aug 20, 2010, at 1:23 PM, Oscar 'offonoll' wrote:
> Hello everyone!
> I got a wired reaction in Rendering a CoreImage Circle that I tweak a bit
> from Christopher. I put a diameter viariable to get a better real size but
> depending on the size, It flips half of the image.
>
> Do you know what is the reason?
>
> Thank you!
>
> Oscar.
> <CoreImage circle size.qtz> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/quartzcomposer-dev/doktorp%40mac.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [email protected]