|
Offline Rendering with QCRendererHello to everybody! First of all, I am quite new to QC, but working with it for some weeks now "demystified" it a lot :-) I already use QuartzCrystal to render QTZs into image-sequences. That works abs. fine but now I want basically to have more control over the image sequence (quality, format etc.) and also want to be able to include my own logic into the renderer (currently using a PHP wrapper to "control" the CLI version of QuartzCrystal). So I looked into the "Quartz Composer Offline" example provided by Apple (http://developer.apple.com/library/mac/#samplecode/Offline/Introduction/...). Based on that, I am able to render frames into JPEGs/PNGs - here my questions: 1) For 10.5 and above, it creates the offline renderer with _renderer = [[QCRenderer alloc] initOffScreenWithSize:NSMakeSize(width, height) colorSpace:colorSpace composition:composition]; CGColorSpaceRelease(colorSpace); Whereby for < 10.5, it uses _renderer = [[QCRenderer alloc] initWithOpenGLContext:_openGLContext pixelFormat:format file:path]; Does it have any advantage in using the "initWidthOpenGLContext" approach? 2) I have noticed, that if my QTZ doesn't have a "clear patch" in it, I see some "garbage" in my frames. I understand that, that but want to know, if there is any way to do the "clear" in my "renderAtTime" loop in case, that I forget to include a "clear patch". 3) I am also trying to read a "published output" from the composition - therefore I implemented: - (id) getPort:(NSString*)key ofType:(NSString*)type { return[_renderer valueForOutputKey:key ofType:type]; } Im my "renderAtTime" loop, I do a NSLog(@"%d", [renderer getPort:@"Result" ofType:@"Number"]); My test-comp publishes "Result" (a "Math expression", which returns 10 and which is connected to a "Sprite" via "Image with Text"), but "NSLog" always returns 0. I guess, that I am at least doing something correct, otherwise I would expect an exception, if I try to read an outputkey, which is not published. Looking forward for your help! Thanks a lot! Thomas
|
One comment regarding 3)
If I do a
... it works fine - which solves my problem, but still I don't understand why it doesn't work with "ofType:@...".
Clear with OpenGL using
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
before you call [myRenderer executeAtTime:time arguments:args];
This ensure the content of the rendering destination is flushed with the current gl clear color and the depth buffer is also cleared. If you have a clear patch in the comp, you will effectively be doing this twice.
As for the difference between a OpenGL context being used and the initWithOffscreen initializer, my understanding is that initWithOffscreen uses a CGLPixelBuffer object and an internal GL context that the QCRenderer handles itself. Handing it a gl context means you are responsible for properly choosing the pixel format, setting the context up, making the context active and disposing of the context once you are done with it.
As for this port stuff, ive never looked at the offline renderer code, but typically you do something like
valid types are: @"CIImage" @"NSBitMapImageRep", @"NSNumber" , @"NSString", etc,
not "Number", "String", "Image". Use the "className" method if you are unsure what to use/enter. That ought to work.
Thanks for your input!
In order to use "glClear", I must have the glContext - correct? How do I do that, if I use "QCRenderer" the easy way (by using "initWithOffscreen")?
Regarding ports: that would explain, why I always got (null) or "0" - sometimes, reading the documentation might help :-)
Thanks!!!
I highly suggest not putting in the glClear and using your own GL context, and just building proper working patches with a clear patch at layer 1.
Once you get into OpenGL, you are going to open up a world of hurt unless you are mentally and programmatically prepared for it. I suggest getting the fundamentals right before jumping into pandoras box head first without a flashlight.. so to speak :)
Also, yes, the documentation. Read it. :)
Even quicklook won't render comps correctly if they don't have a clear. Just assuming that a clear is needed, is probably a good idea; a blank with clear is considered a basic composition.
You are both right - I should take the easy "path" by deploying a "clear patch" rather than fighting with OpenGL, which looks like a pain in the ... :-)
Remembers me doing Xlib and Xt programming long time ago - lots of stuff to code before seeing something.
I came across the following issue while using "Movie Player" (the movie is basically a "motion PNG" within a mov-container) - everything renders fine into images, but I get:
By accident, I found out, that I don't get this, if I compile as "i386" rather than "x86-64" - so can I simply ignore those messages as they might be related to different framework/library version for 64bit?
Again, thanks!