简体   繁体   中英

OpenGL Layer on top of Video on iPhone?

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

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) ;

从少量的信息泄漏看来,您想要的功能似乎将成为OS 3.1的一部分,从而支持增强现实,请参阅AppleInsider上的这篇文章。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM