Graphics Reference
In-Depth Information
LISTING 8-5
Continued
// Bind to the current frame
// This tells OpenGL which texture we want
// to draw so when we make the glTexCord and
// glVertex calls, the current frame gets drawn
// to the context
glBindTexture( CVOpenGLTextureGetTarget (currentFrame),
CVOpenGLTextureGetName (currentFrame));
glMatrixMode( GL_TEXTURE );
glLoadIdentity();
glColor4f(1.0, 1.0, 1.0, 1.0);
glBegin( GL_QUADS );
// Draw the quads
glTexCoord2f(upperLeft[0], upperLeft[1]);
glVertex2f (imageRect. origin . x ,
imageRect. origin . y + imageRect. size . height );
glTexCoord2f(upperRight[0], upperRight[1]);
glVertex2f (imageRect. origin . x + imageRect. size . width ,
imageRect. origin . y + imageRect. size . height );
glTexCoord2f(lowerRight[0], lowerRight[1]);
glVertex2f (imageRect. origin . x + imageRect. size . width ,
imageRect. origin . y );
glTexCoord2f(lowerLeft[0], lowerLeft[1]);
glVertex2f (imageRect. origin . x , imageRect. origin . y );
glEnd();
// This CAOpenGLLayer is responsible to flush
// the OpenGL context so we call super
[ super drawInCGLContext :glContext
pixelFormat :pixelFormat
forLayerTime :interval
displayTime :timeStamp];
// Task the context
QTVisualContextTask(qtVisualContext);
}
 
Search WWH ::




Custom Search