Unsupported — We cannot guarantee that this software will work properly on Mac OS 10.8 and above. Please be careful.

Release: GL Tools, v0.4

Release Type: Production
Version: 0.4
Release Notes

This version of GL Tools contains several enhancements over version 0.3. There are both Leopard and Tiger Versions available.

  • GL Logic Op Patch
  • Faster GL Spline
  • A Field of View patch (not the built-in one)
  • Depth Buffer Alpha Threshold
  • GL Points can now be attenuated by distance

GL Logic Op allows you to control which logic operation is used when drawing pixels to the frame buffer.

Depth Buffer Alpha Threshold allows you to disable writes to the depth buffer for transparent pixels. This helps when you have depth checking enabled and images with transparency.

GL Point attenuation doesn't work on Intel GMA950 Video cards (found in MacBooks and MacMinis). This is a driver bug; please file a bug report with Apple, not us :)

There was one report of invalid patch names for the Tiger build, but we've been unable to reproduce this after testing on several machines. If you experience this, please let us know; we're interested in solving this.

Thanks to all the beta testers for their testing, feedback, suggestions, and patience while 0.4 was in development. :) Between the last beta and this production release, the only change was some interface text (consistent category names across tiger and leopard now), as well as a small fix to the Field of View patch to multiply against the previous matrix instead of simply overwriting it. This will hopefully ease some FOV + Matrix patch combination issues.

GLTools-0.4.zip125.19 KB
GLTools_Tiger-0.4.zip62.36 KB
GLTools-0.4-src.zip339.44 KB

cwright's picture
Screen Shots

Attenuated GL Points.

Depth Buffer Alpha Threshold (on the left, normal on the right)

(composition for this can be found at http://kineme.net/Applications/Compositions/GLToolsSplineComposition)

DepthBufferAlphaThresholdDemo.jpg55.11 KB
AttenuatedDots.jpg54.76 KB

vade's picture
Texture leak with Points - Windowserver lock up with Spline.


I have a reproducible VRam leak with the GLPoint patch.

I took a look at the source, but am unfamiliar with unofficial (skank?) SDK. Im running point inside of an iterator, and leak memory VERY fast. Inside of the iterator I am changing the point size, but nothing else. I have no input image, however, it definitely is a reproducible leak according GL monitor.

I also have not be able to reproduce with 100% certainty, but have had window server lockups when using the the spline patch inside of an iterator as well.

Just a heads up. 10.5.3, X1600.

cwright's picture

can you post a composition that demonstrates this? GLPoint doesn't perform any allocations or GL allocations in the execute method, so it can't really leak.

[UPDATE: The GLPoint and GLSpline issue are due to ATI Errata, not due to a bug in GLTools code. Don't use these patches on those cards I guess... more GL Driver bugs :( ]

cwright's picture
Field of View

I've noticed some weird behaviour with the FOV patch inside other transformation patches (specifically, 3D Transformation and Trackball). This comes from the multiplication with the existing matrix (noted in the last paragraph of the notes above).

The only way around this that I've been able to discover is to put the Field of View patch outside of these patches. In other words, put the transformation patches inside the FOV for expected results.

If there are any mathematicians who know matrix math and know how to solve this, I'd love to hear the right way to solve this.

mazn's picture
gl tools wont show up in QC

I have the .plugin file in both patches and plugins folder on my system library. What am i doing wrong?

cwright's picture
full path

Can you tell us the full path you're placing it in, and which version of OS X you're running?

If you're on Leopard (OS X 10.5), it should be one of the following: /Library/Graphics/Quartz Composer Patches/ or ~/Library/Graphics/Quartz Composer Patches/

If you're on Tiger (OS X 10.4), it should be in /Library/Graphics/Patches/

If you place it in the Plug-Ins folder by accident on Leopard, you'll get some warnings in the console (Console.app), which lets you know that at least QC is seeing the file and trying to do something with it.

mazn's picture
I am running leopard. and it

I am running leopard. and it is in the system/library/gfx/qcpatches

and in system/lib/gfx/qcpulgins and i get this error when i try to open a spline example.

> (null)
<QCNodeManager | namespace = "com.apple.QuartzComposer" | 372 nodes>: Patch with name "GLSplinePatch" is missing
> 3D Transformation
Cannot create node of class "GLSplinePatch" and identifier "(null)"
> (null)
<QCNodeManager | namespace = "com.apple.QuartzComposer" | 372 nodes>: Patch with name "GLSplinePatch" is missing
> 3D Transformation
Cannot create node of class "GLSplinePatch" and identifier "(null)"

These are only a few errors that i get. All the errors are based around not finding the plugin. Thanks

cwright's picture
drop system

don't put them in /System/[anything] -- those are special patches (backdrop, others), and we don't test plugins there, nor do we recommend putting them there.

What happens if, when in /Lib.../qcplugins, you open a composition that uses some of these patches (there are a bunch scattered around the site). If they don't generate any warnings, and appear to work correctly, then it's loaded and working, and you're perhaps searching the patch creator in the wrong place (The category is "Kineme GL", not "Plug-In") or something.

[the other errors could be helpful too -- they sometimes indicate why it's getting confused, etc]

mazn's picture
its working now thanks. but

its working now thanks. but when i open a file example. the replicated spline file from one of the compositions posted here, none of my qc windows pop up. all i get is a blank inspector and no other windows. I have physically open the file through qc. or i get an error like this:

0x953cfc12: GFException
0x953d1855: GFThrowException
0x9531ff1c: +[QCImageManager(ConverterRegistry) registerImageBufferConverterClass:priority:]
0x276a3264: mm_distance2
0x9531e62c: -[GFNodeManager(PlugIns) loadPlugInAtPath:]
0x9531e325: -[QCNodeManager loadPlugInAtPath:]
0x9531e8bf: -[GFNodeManager(PlugIns) loadPlugInsInFolder:withExtensions:]
0x9531e75b: -[GFNodeManager(PlugIns) loadPlugInsInLibrary:withExtensions:]
0x9531e6d3: +[QCPatch(Registry) loadPlugInsInLibrary:]
0x95432bdb: _RegisterPatches
0x9531cc7c: +[QCPatch(Registry) patchManager]
0x937b0bda: _nsnote_callback
0x920ea9da: __CFXNotificationPost
0x920eacb3: _CFXNotificationPostNotification
0x937adfd0: -[NSNotificationCenter postNotificationName:object:userInfo:]
0x937b7668: -[NSNotificationCenter postNotificationName:object:]
0x95657377: -[NSApplication finishLaunching]
0x95656dfd: -[NSApplication run]

thanks for the quick help.

cwright's picture

that's not happening anywhere in our code (we haven't made any image converters, and gltools doesn't do anything with images, except pass them on to opengl...). Maybe you should try the latest beta, and see if it goes away?

toneburst's picture
GL Line Structure

I've just been working with the Kineme GL Line Structure patch, and have noticed a couple of odd things:

  1. The line seems to have quite a high minimum width. Even with low settings, it seems to remain quite chunky.

  2. The alpha channel for the start and end colours seems to be ignored, even with the blending mode set to 'Over' (this is not the case for example, with the GL Point Structure patch).

Not sure if these are intended behaviours or not.

It would also be great to see some kind of antialiasing implemented for this patch, too (as it is with the builtin Line patch).


Quartz Composer Blog: http://machinesdontcare.wordpress.com

Music Site: http://www.toneburst.net

cwright's picture

blending is a known problem in current GLTools stuff - I think I know how to fix it, but I'm still experimenting to see what's happening exactly (it's glBlendFunc stuff).

The line width is probably wide because of different blend settings from the stock GLLine patch -- there are several known issues with "proper" AA line drawing in OpenGL...

These aren't intended; we're working on it :)

(For what it's worth, the structure patches as-is are likely to be abandoned in the near future, in favor of genuine spreads, once we solidify the setup/control for them... then it gets crazy :)

toneburst's picture
Thanks for the reply

Thanks for the reply cwright.

Looking forward to a future release then.

I wonder, will the spreads functionality make it possible to create several discrete lines, each with several points? I'm currently achieving the same with JavaScript and an Iterator patch, but it's horrendously slow.

I'm really looking forward to all these 'Spreadable' patches. It'll make so many of the projects I've been working on so much easier. We still need a set of patches for generating the spreads structures though...

Wonder how toby is getting on with his structure tools.


Quartz Composer Blog: http://machinesdontcare.wordpress.com

Music Site: http://www.toneburst.net

yanomano's picture
Can't wait for spreads...

I Think it is the new killer kineme patch ! You know we are already there for crazy beta testing !...:)

toneburst's picture
Random Spreads JS

I've just been working on this JavaScript code to generate a random spread of a given number of values, and output it as a struct. I'm not very good at JS though, so any comments or things I could do to improve it would be much appreciated.

   Creates VVVV-style spread of random values and outputs as a structure.
   << Controls >>
   -   'Iterations' sets number of values in spread.
   -   'Min' sets minimum possible value.
   -   'Max' sets maximum possible value.
   -   'Randomise' bool repopulates array of random values
       when set to True.
   -   'Offset' offsets all values by specified amount.
   -   'Continuous' is a 'dummy' input port.
       When value arriving at this input is changing, this will force
       continuous updating of random array, as long as 'Randonise' bool is true.
       Should be connected to a switched Patch Time patch.
   toneburst 2008
// Array of random numbers
// Declared outside main loop so is persistent between frames
var rndArray = new Array();
function (__structure Random_Spread) main (__number Iterations,
                        __boolean Randomise,
                        __number Min,
                        __number Max,
                        __number Offset,
                        __number Continuous)
   // Ourput object
   var result = new Object();
   // Array to hold values for output
   // (making it an Array rather than an Object ensures correct ordering of output values)
   var outArray = new Array();
      // Range between Min and Max values
      var range = Max - Min;
      // If 'Randomise' bool is true OR array values not yet set
      // then populate rndArray with random values
      if(Randomise || rndArray[0] == undefined)
         for(i = 0; i < Iterations; i++)
            // Initialise temporary random number variable
            // (number will be float in 0 > 1 range)
            var rnd = Math.random();
            // Set rndArray at index i to random number
            rndArray[i] = rnd;
      // Create output array
      for(j = 0; j < Iterations; j++)
         // Set output array at index j to random number array index j
         outArray[j] = rndArray[j]  * range + Min + Offset;
   // Set final output structure to output array   
   result.Random_Spread = outArray;
   // Output values structure
   return result;

Ultimately, this kind of thing should be done in a custom QC plugin, which I'm sure would work much faster, but for my porpoises, this should work for the moment.

If I ever get around to learning Obj-C/Cocoa, a set of spreads plugins are first on my list, if someone else doesn't beat me to it ;)


toneburst's picture
Linear Spread

   Creates VVVV-style linear spread of values and outputs structure
   containing all values.
   << Controls >>
   -   'Iterations' sets number of values in spread.
   -   'Min' sets minimum value.
   -   'Max' sets maximum value.
   toneburst 2008
function (__structure Linear_Spread) main (__number Iterations, __number Min, __number Max)
   // Initialise output object
   var result = new Object();
   // Array to hold final list of values
   var outArray = new Array();
   // Range between Min and Max values
   var range = Max - Min;
   // Step size between each value
   var step = range / Iterations;
   // Populate output values array
   for(i = 0; i < Iterations; i ++)
      // Set output value at index i
      outArray[i] = Min + i * step;
   // Set final output structure to output array   
   result.Linear_Spread = outArray;
   // Output values structure
   return result;

Incidentally, I've noticed that if you stick code containing '<' and '>' characters inside code tags, it gets confused, so I've been using the preformatted tag.


cwright's picture

Do y'all want spreads to be structures? I was under the impression that were were going to abandon QC objects all together, and pass around C Arrays for spreads (creating a new port that handles this kind of data). The reason for this would be to avoid the not-in-order stuff that sometimes happens with structures, and to handle lots of data really really quickly (no method overhead per item, which is usually cheap for small sets, but gets expensive for larger one)...


(Mind you, these JS patches are still handy as an intermediate solution)

psonice's picture

Anything fast would be priority for me. Faster = more elements = more stuff + better fx. Something that gets around the 'random order' stuff would be great too.

Would it be possible to have a spread to structure patch to keep compatibility though? Not sure if that would be necessary, if there's equivalents to the 'index/key member' patches, but perhaps there would still be cases where javascript would be handy.

cwright's picture
my thoughts

Those were my thoughts too -- message overhead on a per-element basis will make structure 3-6x slower best-case.

It would be possible to "structureize" and "destructureize" a non-structure spread, but then you're going to get a nasty speed hit (the composition is only as fast as its slowest part, and if you shove a million element structure through some per-element processing, it's going to suck no matter how fast everything else is :)

psonice's picture
Non-render dependent stuff

The performance hit wouldn't matter much for doing some processing on the spread where the rendering isn't dependent on it.

E.g. I sometimes process a ton of stuff when the composition loads, and hide it with a loading screen. Other times (like with the slitscan stuff I had so much trouble with) I have 2 parts to the composition, one doing the back-end data processing, the other doing the rendering. The back end might only churn out 1fps, but the front end continues running on old data at 60fps. (Great in some cases, but a real pain in the arse to get around in others, like the slit scanner!)

toneburst's picture
If that's a faster way of

If having a new data type is a faster way of doing it, that's cool. The advantage of using Structures now of course, is that you can use Iterators (though ultimately we're trying to do away with them).

This is definitely an interim solution.

My intention is to test the 'pseudospreads' compositions with an Iterator, and all the per-instance variables being calculated outside the Iterator by JS, and see if this speeds the whole thing up to the frame-rate I was getting by using 128 individual macros instead of an Iterator in my previous tests.


smokris's picture
Code / Syntax Highlighting

toneburst wrote:
Incidentally, I've noticed that if you stick code containing '<' and '>' characters inside code tags, it gets confused, so I've been using the preformatted tag.

To remedy this problem, I installed a syntax-highlighting filter for drupal. You can now use [blockcode] or, say, [javascript] to delineate code blocks, and it'll highlight syntax and automatically handle angle-brackets. More details are available in the "Input Format" section on every compose/reply page.

toneburst's picture
Cool. That's much better

Cool. That's much better smokris.


Installation Instructions

Place the plugin file in
/Users/[you]/Library/Graphics/Quartz Composer Patches/
(Create the folder if it doesn't already exist.)

A set of patches for drawing GL primitives and modifying the GL environment.

Source code is available on GitHub.


Logo by @usefuldesign.au.

Known issues

  • The GL Field of View patch doesn't work properly on Mac OS 10.9 (it produces stretched output).