在 UIImageView 上显示具有透明背景的 EAGLView [英] Displaying an EAGLView with transparent background on a UIImageView

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

问题描述

我有一个显示 OpenGL 3D 模型的 EAGLView 和一个显示图像的 UIImageView.

I have an EAGLView displaying an OpenGL 3D model, and a UIImageView displaying an image.



我想要的是在具有透明背景的 UIImageView 上方显示 EAGLView.



What I want is to display EAGLView above that UIImageView with transparent background.

有什么方法可以在 UIImageView 的顶部显示具有透明背景的 3D 模型.

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

任何解决方案将不胜感激.

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

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

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