>> 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.
>> 
> Aha, this sounds like the kind of thing I need to do. To clarify - does this 
> technique require a published image output? I would like to support arbitrary 
> compositions.

The valueForOutpuKey technique requires a published image output, the FBO 
rendering requires a rendering patch - billboard, sprite, etc. - in the qtz 
compositions.

In CoGe, i detect the composition has a publised image output or not, if not, 
render it to an FBO:


                                if ([[synthAPlayerComp  outputKeys] 
containsObject:@"outputImage"]) {
                                        
                                        [mainRenderer 
setValue:[synthAPlayerRenderer valueForOutputKey:@"outputImage" 
ofType:@"QCImage"] forInputKey:@"imageSourceA"];
                                        
                                } else {
                                        
                                        [mainRenderer 
setValue:[synthAPlayerRenderer renderToFBOatTime:time withArguments:args] 
forInputKey:@"imageSourceA"];
                                }

The renderToFBOatTime:time method renders to a CIImage 
texture:http://code.google.com/p/coge/source/browse/trunk/CoGe/AppController.m#1005





> 
>> I use QCRenderers with own NSOpenGLContext objects and  sharing the context 
>> between the QCRenderers.
> Aha! I was trying to share the openglcontext among the renderers (in the real 
> app), but I was using snapshotImage..
> 
>> 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 - really useful info!
> 
> 
>>>> 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