I am attempting to switch out compositions/renderers seamlessly in my
Cocoa app. By seamlessly I mean without any visible framerate stutter
when changing my composition.
My application currently used to do the following on
applicationDidFinishLaunching: Pre caches QC compositions off of disk
and creates an dictionary of QCComposition objects (I would load via
NSData, and simply set and retain a dictionary of QCComposition
objects).
My reasoning for the above is to negate disk seek times when loading a
QCComposition from a path when using
initWithOpenGLContext:pixelFormat:file: and rather use
initWithCGLContext:pixelFormat:colorSpace:composition: and pass in my
pre cached composition from my dictionary. I figured the hiccup was
due to disk seek. Seemed to be a good idea and made sense. the code
worked, however when switching 'effects' (or rather, wanting to change
QCCompositions for a specific renderer) I have to release the renderer
and alloc a new one, since QCRenderer does not have a class method to
change the current composition (at least, as far as I can find), and I
still had a stutter in framerate (A slight pause).
So in re-thinking the situation I now pre load the compositions same
as above, and also create a second dictionary for QCRender objects and
retain it for later use. Now when changing effects I simply swap to a
pre-created QCRenderer object.
However, I still see a delay/pause/stutter.
Thus my question: How does one seamlessly switch out QCRenderers
programatically without causing framerate stutters?
I should note that I am using cocoa controls, and my app is at this
point not multithreaded in any way. All of my renderers are using the
same NSTimer and my timer is set to NSEventTrackingRunLoopMode, so
Cocoa controls do not interrupt drawing.
Do I have to stop my timers while switching out QCRenderers ?
Why does QCRenderer not have a setComposition:(QCComposition
*)compositionData; method?