Quartz Composer

iniTree - draw your own recursion tree

LukeNeo's picture

Hello there, I just want to share with you a simple that draws a ternary tree. The algorithm is very simple and uses recursion. Here is what it does in pseudocode (for n-ary tree):

  1. main{
  2. max_levels = 10 //the max num of levels
  3. tree(initLenght, 1);
  4. }
  5.  
  6. tree(length, level){
  7. if(level<max_levels){ //is the end of the recursion?
  8. n = 3 //it is a ternary tree
  9. for(x=0; x<n; <++){
  10. pushMatrix()
  11. rotate ((360 / n)*x) along y axis
  12. rotate (aperture) along z axis
  13. drawLine(0,0,0, 0,length,0) //from 0,0,0 to 0,length,0
  14. translate(0,length,0)
  15. tree(lenght/2, level+1) //recursive call
  16. popMatrix()
  17. }
  18. }
  19. }

As you can see, I used glRotate/glTranslate and glBegin(GL_LINES)/glEnd() calls, in old OpenGL style. Maybe this is the reason why with more than 8/9 levels I don't obtain good performance. Using vbo will result in better performance, but I'm still not sure about how to do that.

It is a very simple plugin, but if used in audio-reaction compositions I think it can produce interesting results. So let me know if someone use it in some cool way! :)

Download(plugin and example composition)

DMX+Arduino+QC help

RaViCore's picture

hi! I'm italian guy, I would to ask an important question to people from this forum because i can't find the answer around the web. I would like to link the lighting system (DMX) to a club to ARDUINO and manage it in QUARTZ COMPOSER...how can i do it??? i'm waiting for answers. thank you for your help!!!

Core Image Conundrum

cybero's picture

I wonder why this Core Image kernel code isn't working for me. It was found on the fromaremotevillage blog. http://fromaremotevillage.blogspot.com/2007/03/cocoa-application-with-cu...

/*
A Core Image kernel routine that computes a convolution effect.
The code looks up the source pixel in the sampler and then multiplies it by the value passed to the routine.
*/
 
kernel vec4 Convolution3by3(sampler image,
float r00, float r01, float r02,
float r10, float r11, float r12,
float r20, float r21, float r22)
{
  vec2 loc;
  vec4 result = vec4(0,0,0,0);
  //0,0 in my mind is left and up.
  loc = vec2(1.0,0.0);
  vec4 p12 = unpremultiply(sample(image, (samplerCoord(image) + loc) ));
  result.rgb += p12.rgb * r12;
 
  loc = vec2(-1.0,-1.0);
  vec4 p20 = unpremultiply(sample(image, (samplerCoord(image) + loc) ));
  result.rgb += p20.rgb * r20;
 
  loc = vec2(0.0,-1.0);
  vec4 p21 = unpremultiply(sample(image, (samplerCoord(image) + loc) ));
  result.rgb += p21.rgb * r21;
 
  loc = vec2(1.0,-1.0);
  vec4 p22 = unpremultiply(sample(image, (samplerCoord(image) + loc) ));
  result.rgb += p22.rgb * r22;
 
  result = premultiply( result );
  return result;
}

Currently produces nothing more than blank empty space when run in QC 4.5 on Lion. Haven't tried it in Snow or earlier as yet.

JavaQCView (Composition by dust)

Author: dust
License: MIT
Date: 2011.01.16
Compatibility: 10.6
Categories:
Required plugins:
(none)

this isn't really a composition its basically a java jni lib to render quartz composer in java. eventually i will have the messaging system working so you can send messages back and forth from qc to java....

right now it just loads a qc comp from the repo and displays it in java. the principles are derived from a deprecated apple dev example "qc cocoa component" circa 2005.

even though this builds a binary java app, i don't see why the lib couldn't be used in processing to display a qc comp.

don't know if the helps anybody but i certainly like being able to load a qc comp in java. the next step is to get published inputs and outputs working.

Broadcast Quartz Compositions with Wirecast, use MIDI to control

randall's picture

Hey kids,

This isn't directly QC specific, but I figure a lot of you might be interested in this stuff. I just wrote up a tutorial about controlling Wirecast, a piece of software meant for video broadcasting (Justin.TV, and recording locally) using Midi + AppleScript.

http://bit.ly/fzWSqG

I figure you guys might find it useful. Wirecast has weird QC support. It half works, but it's really sketchy. If you wanted to though, Wirecast does support screen capture, so you could capture part of the screen showing a QC comp, and broadcast it to the web live.

Feel free to hit me up with questions on here, or email me / comment on the post.

Later, rb