Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
Read Me.txt
Read Me: OpenGL Compositor lab |
This sample demonstrates using OpenGL to composite multiple sources in hardware. It requires NVIDIA GeForce 4 Ti hardware for full functionality. |
The compositor lab operates on graphic content in various layers allowing one to apply blending effects to each separate layer. One can select layer by clicking on it's content (which can also be moved by dragging the actual content). Layers can be added via the Open menu or by dragging and dropping images or movies directly on the content window. Effects are controlled by the info panel activated via the Tool menu. |
Layers may be scaled by holding down the shift key when dragging a layer. You can also do a perspective quad warp by opt-dragging the corners of the layers. |
The info panel consists of two tabs: Compositing and Effects. The compositing tab controls background clears, polygon and layer blending. The effects tab controls background color removal, color correction and overall color matrix manipulation for the selected layer. |
Source can be images, movies, a Firewire DV stream. Movies can be dragged and dropped but images and DV streams need to be added via the application File menu due to sample limitations. |
All layers can be resized with a shift-drag and skewed with option-drag. |
Known Issues: |
The OpenGL QuickTime component does not deal with uncompressed YUV source material. This would come into play if you were trying to use the video capture layer from something like cheap FireWire web camera. |
The color removal code only works on a GeForce 4, as it depends on the NV_texture_shader_2 extension for doing dependent 3D texture reads. |
Example functionality: |
Chroma key color removal |
- set a background image |
- drag movie to compositor |
- open tools panel |
- in Compositing:Layer set "src Blend" to SRC_ALPHA |
- in Compositing:Layer set "dst Blend" to ONE_MINUS_SRC_ALPHA |
- in Compositing:Layer check Enable Blend box |
- in Effects:Background Removal check Enable box |
- in Effects:Background Removal select color to remove with color well |
- in Effects:Background Removal use slider to control chroma matching |
Color correction (replace source color with destination) |
- drag movie to compositor |
- open tools panel |
- in Effects:Color Correction check Enable box |
- in Effects:Color Correction select source and destination color with color well (source color will be converted to destination) |
- in Effects:Color Correction use slider to control how closely source color needs to match |
(Note: Color correction can be combined with background removal) |
Color matrix |
- drag movie to compositor |
- open tools panel |
- in Effects:Color Matrix check Enable box |
- in Effects:Color Matrix use sliders to adjust overall layer color matrix |
Compositing |
These are handled just like OpenGL blending and respect all components of source material. |
The code is organized as follows: |
Component Includes: prototype files for QuickTime components |
GL Components: Source for QuickTime transfer CODEC supporting OpenGL |
Classes: code for UI, display and handling of multiple OpenGL layers |
Other Sources: matrix utility code and main |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-04-21