Graphics Reference
In-Depth Information
LISTING 9-4
Continued
// Call super to ensure the OpenGL context gets flushed.
[ super drawInCGLContext:glContext
pixelFormat:pixelFormat
forLayerTime:timeInterval
displayTime:timeStamp];
}
@end
The call to -canDrawInCGLContext can be overridden depending on whatever criteria you
specify. When rendering video like we did in the Chapter 8, we used this call to deter-
mine if the next video frame were ready to draw. If it were, we returned YES; otherwise
we returned NO . Then, if we returned YES , -drawInCGLContext actually handled the
drawing of our quads in the OpenGL context. Take a look at Chapter 8 if you want under-
stand how to take advantage of this feature.
Summary
Quartz compositions provide a simple way to create complex visualizations. The limit is
only in what you can think up. This sounds like a cliché, however, it is actually the truth.
There are times when your application requires animation or other visual elements and
you might be tempted to code them by hand. You might want to reconsider that
approach depending on how complex the visualization is.
Why write code when you can simply add the elements and effects to a Quartz composi-
tion and control those effects and elements by publishing inputs and outputs? When you
start thinking this way, ideas can begin to open up in your mind. The Core Animation
Quartz Composition Layer, QCCompositionLayer , provides an intuitive way to incorporate
your compositions into your Cocoa applications.
 
 
Search WWH ::




Custom Search