Hi Patrick,

I just improved the composition from Miroslaw in pretty much the same way as your solution for the "gaussian" version of the filter looks like. Maybe you can fiddle in there your code and get rid of all your questions ;-)

1) It is, because you don't respect the gl_TextureMatrix of the the src texture. Textures can be flip, but the matrix always put them back correctly. You have to use the gl_TexCoord[0].xy in the fragment shader to get correct xy-coordinates, they are transformed in the Vertex Shader by the texture matrix.

2) the "default" implementation of the GLSL shader puts in a "uniform sampler2D texture;" which is misleading! This means, that the input for the texture has to be a square. so QC is converting your input image to a square texture and feeds this into the GLSL-shader (and manipulates the texture-matrix that way, that the image-aspect ratio is still correct!). Your code ready the native texture size with textureSize2D(src, 0) which is 512x512 I guess in your case. Replace all "sample2D" with "sample2DRect" to get your original texture in the correct size.

3) You have to use a "Render in Image"-Patch to render the GLSL-Shader into a new texture to use it in following patches.

Best,

Achim

Attachment: compound-gaussian 1.qtz
Description: application/quartzcomposer


On 16.08.2010, at 09:27, Patrick Sheffield wrote:

Thank you, Miroslaw - that works, I'd never played with an OpenCL patch...

Toward that end, I've been trying out some GLSL routines, but I have a few questions for anyone out there:

<gaussian1.qtz>

First, why does this composition flip the image?
Why does it mess with the aspect ratio?
And how would I feed the output of a GLSL patch to do further processing?

I realize a Gaussian blur needn't be done in a GLSL patch - could be handled in a CI kernel, etc... but I have other GLSL routines I'd like to use.

Thanks for any insight you might have,

Patrick

On Aug 15, 2010, at 5:31 AM, Miroslaw Rusin wrote:

thanks for the info. so it's something more like this then...

<compound-3.qtz>


it's slow - O(x*y*r²), where:
x - image with
y - image height
r - radius

can be O(x*y) with sum table

M


_______________________________________________
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/achim%40boinx.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]

Reply via email to