I passed over that briefly, but it didn't catch my attention because
it didn't appear to give me any way to ensure that one composition
was rendered before the other, or to capture the rendered frame from
the first. So I went for the second route, with your help:
You could use a Composition Loader patch and set it to the composition
whose frame you want to load. You can easily change the composition at
run time, so as long as they conform to the same protocol you should
be fine.
First, I realized that CAOpenGLLayer's drawInCGLContext:::: method
is called on the main thread
This depends on how you drive the layer. If you set the asynchronous
property to YES, then it will be rendered from a secondary thread.
Granted, the thread that it is drawn from is an implementation detail
and can change in the future, so it is safest to always be thread-safe
inside of your drawInCGLContext:::: method.
, so I threw out all my lame attempts at using the display link
callback and went with an NSTimer.
If you really just want asynchronous rendering, then setting
asynchronous=YES should give superior results to using an NSTimer.
I don't really understand what the display link is, and it works
just fine this way. (I'm still curious though, does using the
display link give you any kind of performance benefit?)
A display link basically gives you a notification when the display is
about to refresh, which is a hint that if you display whatever you
have rendered right now then you should not see any tearing or other
display artifacts.
Despite the decree of "you should not call this method directly" in
the documentation for -[CALayer display], calling it directly does
seem to work just fine and it lets me render the different
compositions in the right order. I'm not thrilled about defying the
documentation gods, but at least it's a public method.. I should
ask, though: is there a better way to do it?
There is nothing inherently wrong with calling -display, but it
basically says "draw now". But I think you might be able to do this a
bit more easily with a Composition Loader patch (since you already
seem tired to 10.5 anyway :) ).
Many, many thanks for your help! This got me to my "proof of
concept" milestone, what I've been aiming at for the last month or
so. The concept's far from proven, but it gives me a lot of fun
stuff to play with.
Glad I could help!
--
David Duncan
Apple DTS Animation and Printing
email@hidden