Graphics Reference
In-Depth Information
FIGURE 8-1
Visible Objects
Implementing the CAOpenGLLayer-Derived OpenGLVidGridLayer
The
CAOpenGLLayer
derived class,
OpenGLVidGridLayer
, provides the entry point for
drawing all the video channels to the same OpenGL context. The initialization code
accepts a list of
QTMovie
objects for which it calculates the display rectangle. It creates a
VideoChannel
object for each of the
QTMovie
s and adds them to an array. The
VideoChannelController
object is then instantiated, and the array of
VideoChannel
objects is assigned to it. The implementation code is shown in Listing 8-6.
LISTING 8-6
Implementing OpenGLVidGridLayer Initialization Code
- (
void
)initVideoChannels;
{
int
i = 0;
if
(
videoChannels
!=
nil
)
[
videoChannels release
],
videoChannels
=
nil
;
videoChannels
= [[
NSMutableArray alloc
]
init
];
// Create a grid kColCount across
float
vidWidth = [
self
frame
].
size
.
width
/
kColCount
;
vidWidth = vidWidth -
kMargin
;