关于iPhone视频顶部的OpenGL层? [英] OpenGL Layer on top of Video on iPhone?

查看:135
本文介绍了关于iPhone视频顶部的OpenGL层?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示在iPhone上全屏视频,并与OpenGL ES的看法覆盖它。所以基本上,我希望有一个视频在后台播放,同时也有它的顶部正在绘制OpenGL图形。

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?

感谢您的帮助!

弗洛里安

推荐答案

要显示摄像头的视频背景,自定义重叠视图,可以使用的UIImagePickerController的cameraOverlayView财产。该cameraOverlayView将在默认图片选择器界面的顶部显示。使用cameraViewTransform属性,以使相机preVIEW全屏。

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

要实现一个UIView子类为支持OpenGL ES渲染重叠视图,采取看苹果的样品code <一个href=\"http://developer.apple.com/iphone/library/sample$c$c/GLGravity/Listings/Classes_GLGravityView_m.html\" rel=\"nofollow\">http://developer.apple.com/iphone/library/sample$c$c/GLGravity/Listings/Classes_GLGravityView_m.html

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

在您的OpenGL ES渲染code,确保清晰的彩色与零阿尔法。

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

glClearColor(0,0,0,0) ;

这篇关于关于iPhone视频顶部的OpenGL层?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆