views:

1060

answers:

2

Hi there.

I am trying to display a fullscreen video on the iPhone and overlay it with an OpenGL ES view. So basically, I want a video playing in the background, while there are OpenGL graphics being drawn on top of it.

How do I achieve this and is it even possible?

Thanks for your help!

Florian

+1  A: 

From the small information leaks it seems that the feature you want will be part of OS 3.1, allowing support for augmented reality, see this post on AppleInsider.

Timothy Walters
A: 

To display a camera video background with a custom overlay view, you can use UIImagePickerController's cameraOverlayView property. The cameraOverlayView will be displayed on top of the default image picker interface. Use the cameraViewTransform property to make the camera preview full screen.

imagePickerController.cameraViewTransform = 
CGAffineTransformMakeScale(1.0, 1.03);

To implement an UIView subclass as the overlay view that supports OpenGL ES rendering, take look at Apple's sample code http://developer.apple.com/iphone/library/samplecode/GLGravity/Listings/Classes_GLGravityView_m.html

The key is to make your overlay view transparent.

overlayView.opaque = NO; 
overlayView.alpha = 1.0; 
overlayView.backgroundColor = [UIColor clearColor];

In your OpenGL ES rendering code, make sure to clear color with a zero alpha.

glClearColor(0,0,0,0) ;
Arrix