显示用透明背景的EAGLView上一个UIImageView [英] Displaying an EAGLView with transparent background on a UIImageView

查看:249
本文介绍了显示用透明背景的EAGLView上一个UIImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我有一个EAGLView这显示某些OpenGL的3D模型,以及一个UIImageView是显示图像。

我要的是显示EAGLView上面的UIImageView。无论我做什么,它使上述EAGLView显示的UIImageView。

In my app, I have an EAGLView which is displaying some OpenGL 3D model, and a UIImageView which is displaying an image.

What I want is to display EAGLView above that UIImageView. No matter what I do, it keeps displaying UIImageView above EAGLView.

有什么办法来显示该三维模型透明背景,对的UIImageView或UIView的顶部。

Is there any way to display this 3D model with transparent background, on top of the UIImageView or any UIView.

任何解决方案将AP preciated。

Any solution would be appreciated.

推荐答案

下面是我找到了解决办法:

Here is the solution I found:

在EAGLView.m初始化

In EAGLView.m initialization

self.opaque = NO;
self.backgroundColor = [UIColor clearColor];

CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = NO;

CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
const CGFloat myColor[] = {0.0, 0.0, 0.0, 0.0};
eaglLayer.backgroundColor = CGColorCreate(rgb, myColor);
CGColorSpaceRelease(rgb);

这篇关于显示用透明背景的EAGLView上一个UIImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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