简体   繁体   English

iPhone相机图像上的3D模型。 透明背景?

[英]3D model over iPhone camera images. Transparent background?

I'm trying to make an augmented reallity app for iPhone where you can see, over the camera images, 3D models built using OpenGL ES. 我正在尝试为iPhone开发增强现实应用程序,您可以在摄像机图像上看到使用OpenGL ES构建的3D模型。 I've already made the part where I get the images from the camera and a GLView that inherits from UIView where I draw the model. 我已经完成了从相机获取图像的部分以及从UIView继承模型绘制的GLView的部分。 My problem is that when I put the GLView over the camera images, you don't see only the model but a black rect covering all the view. 我的问题是,当我将GLView放在摄像机图像上时,您不仅会看到模型,而且会看到覆盖所有视图的黑色矩形。 I've tried to colour the background so it becomes transparent but I haven't got it. 我尝试为背景着色,使其变为透明,但我没有。 Do you know which one could be the problem? 您知道哪个可能是问题吗?

Thanks a lot!! 非常感谢!!

I answer myself. 我回答自己。 Appart from using glClearColor when you draw the OpenGl View, you need to have in mind to things: 绘制OpenGl View时使用glClearColor Appart,您需要牢记以下glClearColor

  • When you create your CAEAGLayer object, you have to assign its opaque property the value NO . 创建CAEAGLayer对象时,必须为其不透明属性分配值NO

  • When you assign the drawableProperties , you have to choose a color format that admits transparency, for example kEAGLColorFormatRGBA8 . 分配drawableProperties ,必须选择一种允许透明的颜色格式,例如kEAGLColorFormatRGBA8

Hope this will be useful to someone else! 希望这对其他人有用! Thanks Benjamin Andris for your answer anyway! 无论如何,都要感谢本杰明·安德里斯(Benjamin Andris)的回答! :) :)

您是否已将GLView的'opaque'属性设置为NO?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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