Fullscreen-resolution alignment problem: Rendering Destination Dimensions solves

I often had the following problem: made a patch, but when running in fullscreen or on another computer with a different resolution, things change, i.e. quads were aligned differently to the borders of the patch or in relation to other quads. Than I learned about the “Rendering Destination Dimensions”-module.
The ”Rendering Destination Dimensions” works quite simple: it provides the missing, useful information about the current resolution, the patch is running on. Just plug it into i.e. billboard or sprite node - and you will always be happy with the result - no matter on what resolution, ratio or hardware your patch will run on.
Initialize Iterator with a defined set of values (array)

You know the problem - you have a Iterator module with nice thing going on in the module. But you want more precise control over the initialization of the single iterated objects. A good way to init values is using the JavaScript module and so some good old text-coding. In this example I inited two simple arrays. The value at the outlets are selected by the Current Index of the Iterator Variables. Simple, but powerful. This technique works perfectly together with the OOP-driven patching style.
JavaScript Input / Output mapping

The JavaScript module comes in very handy, if you want to quickly do think you are used to do in code (i.e. constraining / wrapping variables, make more complicated calculations, calculate dependencies etc…). But how do you integrate that module into a patch?
There are inputs on the left side and outputs to the right side. At the first sight it does not seem clear, how to return values from the JavaScript function to appear as outlets. But this basically is really easy: all you have to do is to return a JavaScript “Object”, that has the output-values attached as parameters. So, if you want to have a X and Y outlet, that create an Object, i.e. “Result” and create parameters X and Y at the result object. Fill the parameters with values and just return the object. In the init-line of the function you define the datatype and name if the single variables (__number X, __number Y).
The input side of that object is handled very similar. You define the input type and name of the input parameters. In our case we use an array to define the inputs.
Object Orientated (OOP) Style with Feedback Module

If you are used to program object-orientated programming languages like Java or Objective-C it can sometimes get hard to make certain things in Quartz Composer. The patching-paradigm does not allow a use of “writing classes” and “make instances of that classes”. But you can nevertheless make something similar in Quartz Composer - utilizing the Feedback module in a macro patch.
The Feedback module does the following: it takes a published output and feeds it into the feedback-module. The value is in the next frame available at the Feedback outlet. With that module you can make things like incremental motion.
The input of the Feedback module is a “initial parameter” - that parameter will be fed in tot eh feedback outlet at the very first frame. From frame two on, that fed back parameter will be used.
To add new inlet/outlet to the Feedback module, just publish any value of the patch as a output-parameter. The Feedback will update its parameter instantly.
Notice: The feedback module must be inside a macro-patch to work properly.
With Iterator and a Structure you can instantiate some sort of “module array” and work a little like object-orientated style in Quartz Composer. Here I wrote a tutorial how to do it: Initialize Iterator with a defined set of values.
Reset / Loop / Control Timeline of a Patch or Macro


There is a simple way, to control the behavior the timeline of a patch or macro. Just select the module, you want to control the timeline of with the right mouse (or control+click), then select “Timebase” -> “External”. This sets the timebase of the module to listen for an “outside timeline”. Feel free to plug whatever you want into that input to modify its “global timeline behavior”, for example an LFO. If you are in a macro, you can also publish this port and control the macros timeline from outside the macro.
Random-Position in Iterator Module

Setting objects in iterator modules “freely” or “random” can be a little hard, because you can get “Iterator Variables”, that are only linear scales of the single objects. For example you get variables like 0, 1, 2, 3… or variables between 0..1. Setting your objects with that value you can get easily linear distributions, but nothing by random.
There is a simple quick method to place the objects by random. The module you need it “Perlin Noise”. Set different x and y settings to get a nice random distribution. There are also opportunities with Perlin to make decent animations.
Simple Scene Manager

This is a simple, but effective approach, to make a scene manager in Quartz Composer patches. The Boolean Demultiplexer works as input source. You put in the number of the scene you want to show. The type of output is “Boolean”, so only 1 or 0. This enables or disables the connected scenes. The bool-values are connected the enable-input of the patches. So if not used, than the patch went to “sleep mode”. Very important: The Use Reset Value flag must be set. If not set, the enable-values of the non-active outputs stay at 1 and will not be set to 0 automatically.
Sample and Hold: Temporary save a value

This patch saves a value in the sample and hold module. In that case pressing the “key-down” triggers the saving of the value. You can feed any other changing signal into the sampling input.
Video-Framebuffer with Queue Module

This is how to build a simple “Framebuffer”, using the Queue-module: The video-input is feed into the Queue-module. The Queue Size set the length of the framebuffer-delay. To get the delayed image, we use the Structure Index Member module. Set the Index to “0” (zero) to get the frame, that is delayed by the Queue Size value. Of cause you also have access to all other structure-members from the queue, settings the index value from the Structure Index Member from 0..(Queue Size-1).
To get a bigger delay, you would normally set to Queue Size to a higher value, while setting the Index of the Structure Index Member always to 0.
You do not has to use a video-signal as input source. With that given design, you can build a buffer for any value that are present in your patch.
Edit Core Image Filter Code in Quartz Composer

If you want to write Core Image Filters, you will use the Core Image Filter module in Quartz Composer. Click on the Core Image Filter Module, open the Preferences Panel, go to the Settings drop down. There you got the code. Notice the additional options like “Edit Filter Function” (that will open another window with editable code). “Show Advanced Input Sample Functions” will show additional input-nodes at the module view.
There is a comprehensive documentation about the Core Image Filter programming language at the dev-site of Appel. Core Image Filters are also known as Core Image Kernels. A beginners guide is also available at the Apple Documentation.
HOW DO I FORCE PATCHES TO EXECUTE?

While learning how to use patches, it is handy to use tooltips to investigate what outputs are produced given specific inputs. The problem comes when the tooltip results don’t seem to change whatever the inputs are set as.
As compositions are executed ‘from graphics back to the logic’, patches don’t execute unless they are connected (either directly or through other patches) to a patch that draws on the screen.
However some patch outputs can’t be connected directly to patches, but all outputs can connect to the ‘Enable’ input of the Billboard patch. Once an output is connected, the tooltip result will update correctly.
- alex4d
Simple Debugger / Text-Console in Quartz Composer

This is how you can build yourself a simple text-console like debugger. You use a Image with String module and connect it to a Sprite or Billboard renderer. The string-input of the Image with String is where you feed your debug-values.
Where do I edit the GLSL-Shader-Script?

If using the GLSL Shader Module, it can be hard to find the actual shader script to view and edit. Where to find it? You have to click on the Patch Inspector, than on the GLSL Shader. Then in the Patch Inspector itself select “Settings” in the drop-down menu. There is the editor, where the GLSL-Script is edited.
Get Color from Image-Pixel

This is how to use a color from an image-pixel as background-color. This patch uses Clear, Image Pixel and RGB Color. The values of Pixel X and Pixel Y in Image Pixel are useful to use int, although parameters can also be float.