Why you using offscreen composition and a for circle for rendering? Use an NSTimer to fire out rendering routine (or using a Core Video displaylink), init the compositions with QCRenderer initWithComposition and pass the a and b compostion's image to the mixing compostions something like this:
[QCRenderer3 setValue:[QCRenderer valueForOutputKey:@"outimage" ofType:@"QCImage"] forInputKey:@"inputA"]; Check out my CoGe source: http://code.google.com/p/coge/source/browse/trunk/CoGe/AppController.m On Oct 29, 2010, at 10:10 AM, Rua Haszard Morris wrote: > I'm trying to use a transition patch to transition between the output of two > other animations. The problem I'm having is that sometimes this is not > rendering > fast enough to be rendered in real time. It seems that rendering a frame of > the > transition qtz occasionally balloons out to 1.5 s. > > I've written a test loop to investigate what's happening, and it seems that > every 9 or so seconds, the render takes a second or more, as opposed to the > usual <0.05 s. > > What should I do to optimise the rendering of these animations? I'd like to > be > able to render full screen (i.e. 1280x720+) and in real time, e.g. at frame > rates of 30 (ideally 60) per second. I'm sure this must be possible with > Quartz! > > Here's the (quick & dirty!) test code. Tests were run on a 2.4 GHz MacBook > Core > 2 Duo with 2 GB. > > > NSString* inputQtz1 = [[NSBundlemainBundle] > pathForResource:@"InputA"ofType:@"qtz"]; > NSString* inputQtz2 = [[NSBundlemainBundle] > pathForResource:@"InputB"ofType:@"qtz"]; > NSString* mixQtz = [[NSBundlemainBundle] > pathForResource:@"Dissolve"ofType:@"qtz"]; > > // open qtzs > QCComposition* qtz1 = [QCComposition compositionWithFile:inputQtz1]; > QCComposition* qtz2 = [QCComposition compositionWithFile:inputQtz2]; > QCComposition* qtzmix = [QCCompositioncompositionWithFile:mixQtz]; > > // args > NSDictionary* transitiond = [NSDictionarydictionaryWithObjectsAndKeys: > QCCompositionInputPreviewModeKey, [NSNumbernumberWithBool:YES], > NULL > ]; > > // set up renderer(s) > CGColorSpaceRefco = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); > QCRenderer* renderer1 = [[QCRendereralloc] > initOffScreenWithSize:NSMakeSize(1280, 720) colorSpace:co composition:qtz1]; > QCRenderer* renderer2 = [[QCRendereralloc] > initOffScreenWithSize:NSMakeSize(1280, 720) colorSpace:co composition:qtz2]; > QCRenderer* renderer3 = [[QCRendereralloc] > initOffScreenWithSize:NSMakeSize(1280, 720) colorSpace:co composition:qtzmix]; > > // now render a frame at a time for a while and see how long it takes > double tmp, max=std::numeric_limits<double>::min(), > min=std::numeric_limits<double>::max(), total; > int count = 0; > NSTimeIntervalelapsed = [NSDatetimeIntervalSinceReferenceDate]; > for (NSTimeInterval time=0; time<60; time+=1.0/60.0) > { > NSAutoreleasePool* pool2 = [NSAutoreleasePoolnew]; > > elapsed = [NSDatetimeIntervalSinceReferenceDate]; > [renderer1 renderAtTime:time arguments:nil]; > [renderer2 renderAtTime:time arguments:nil]; > [renderer3 renderAtTime:time arguments:transitiond]; > > tmp = ([NSDatetimeIntervalSinceReferenceDate]-elapsed); > std::cerr << "render " << time << " took " << tmp << std::endl; > elapsed = [NSDatetimeIntervalSinceReferenceDate]; > count++; > > [pool2 release]; > > if (tmp < min) > min = tmp; > if (tmp > max) > max = tmp; > total += tmp; > } > > std::cerr << "min " << min << std::endl; > std::cerr << "max " << max << std::endl; > std::cerr << "total " << total << std::endl; > std::cerr << "average " << total/count << std::endl; > Thanks in advance - I'm sure there's something obvious I'm not doing that > would > speed this up.. > Rua HM. > > -- > http://cartoonbeats.com > http://haszaristwocents.blogspot.com > http://myspace.com/haszari > http://last.fm/music/Haszari > > > > > _______________________________________________ > 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/tamas.lov.nagy%40gmail.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]

