>> Why you using offscreen composition and a for circle for rendering?
> Just to investigate the timing! 
> 
> But thanks for the tips - and I was aware of your CoGe project, nice work!
> 
>> 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"];
> I am essentially doing this in the real app at the moment, though I am 
> interested in the most optimal way of passing image inputs. I would like to 
> support arbitrary qtzs for the inputs, and standard (protocol conformant) 
> transitions for the transition, applying the output of each qtz to the 
> source/destination inputs. The qtzs are under the user's control, i.e. I want 
> to 
> support user-generated transitions.

in my tests, passing images between composition with valueOfOutputKey:OfType 
with QCImage is the best option, BUT if the composition have to render 
something with a billboard for example, 
better to render it to an OpenGL FBO and passing the texture to the next 
composition rather then using a render in image patch in QC and use a published 
output.

I use QCRenderers with own NSOpenGLContext objects and sharing the context 
between the QCRenderers.

Never figured out a faster way to do this - and thanks for Vade the pointing me 
to the right direction some years ago :)

> 
> I had tried using QCRenderer createSnapshotImageOfType using QCImage in my 
> real 
> app, but this didn't solve the performance problem (and it introduced 
> rendering 
> problems!).

createSnapshot is really slow...

> 
> thanks
> Rua HM.
> 
>> 
>> 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]

Reply via email to