QCRenderer

akaioni's picture

I asked it on the forum, but I thought it is a bit complicated matter to leave just as a reply. I m currently searching for QCRenderer in my Xcode, I vaguely remember it being there (file>add new file) before update to new version. Did the QCRenderer Class disappear or am I mixing my information up?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: QCRenderer

Do you mean /System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/QuartzComposer.framework/Versions/A/Headers or perhaps Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Quartz.framework/Versions/A/Frameworks/QuartzComposer.framework/Versions/A/Headers ? Perhaps you need to rebuild code index.

dust's picture
Re: QCRenderer

you can load control and play a composition with the render as well as do other things.. your more than likely wanting to use it like a qcview. you can do interesting things like render off screen etc...

you need to initialize your qcrenderer set up the context buffer to render to then do what you want like this.

NSOpenGLContext*     context = [myNSOpenGLView openGLContext];
NSOpenGLPixelFormat*  format = [myNSOpenGLView pixelFormat];
NSString*               path = @”/Users/MyName/MyComposition.qtz”;
QCRenderer* myRenderer;
// Create a Quartz Composer renderer.
myRenderer = [[QCRenderer alloc] initWithOpenGLContext:context
                                           pixelFormat:format
                                                  file:path];
// Render the first 10 seconds of the composition with steps of 1/25s.
for(double t = 0.0; t <= 10.0; t += 1.0/25.0)
{
  [myRenderer renderAtTime:t arguments:nil];
  [context flushBuffer]; //Required on double-buffered contexts
}
// Clean up
 [renderer release];

akaioni's picture
Re: QCRenderer

ok, silly question, where do I write it in. All these new languages make me confused. I'm sorry for asking such noob questions

dust's picture
Re: QCRenderer

your .h file is your header. this is where you declare your global ivars set your properties and make your methods. for instance inside your header Interface you would set global ivar like id * variable; where I'd is your data type. like nsstring * string; under that you put your property so you don't need to make getter and setters. make sure the property is u deer the braket of interface but before @end like @property(read write, retain) nsstring *string. the star denotes that string is a reference to the object nsstring which ultimately gets inherited from nsobject. after property you write a method like. -(void)run;

now what this all does is let you use the variable inside your .m in any function or method you want because it is global. for instance inside the .m under the implementation you will want to synthesize your variable. think of this as allocating it to memory based on your property declaration.

so under the synthesize you would put your -(void)run {

float value =33.3; self.string = [nsstring stringwithformat:@"%f",value];

}

so float value is a local variable that can only be used inside the run method. you call self.string to set the float to your global variable string. the strinpg with format casts the float data type to a sting type. so inside some other method you can assign the string.

I know this has little relevance to the render but think of the render as an object like nsstring.

the code above is local meaning it goes inside your .m file.

if your still trying to have a preview screen of your comp there is an easy way to do this wi just the stock qc app Xcode template. get the plugin called spooky here on kineme. make two compositions one is your preview and the send via spooky to your viewer comp. then in Xcode just load up both comps to different windows and you will have a preview.

oh don't copy any of this code as i wrote it on iPad it was just example for explanation purposes.