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

查看:14
本文介绍了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 属性使相机预览全屏.

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 渲染的覆盖视图,请查看 Apple 的示例代码 http://developer.apple.com/iphone/library/samplecode/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 渲染代码中,确保使用零 alpha 清除颜色.

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天全站免登陆