0

我正在尝试为我的游戏制作透明的 openGLView,我希望它只对我游戏中的一个功能透明。实际上,它是与设备的相机相关的功能。我正在为我的相机使用 UIImagePickerController,但我无法使 GLView 透明。

我尝试过使用 Ray 的教程,我在这里发布了一些代码:

glClearColor(0,0,0,0);

[CCDirector sharedDirector].openGLView.backgroundColor = [UIColor clearColor];
[CCDirector sharedDirector].openGLView.opaque = NO;

然后我有一个 UIView,我将它作为子视图添加到 UIWindow,然后我将 Picker 视图添加到 UIView。

关于如何使这个 openGLView 透明的任何想法?

谢谢你的时间。

4

1 回答 1

2

请尝试以下代码以实现透明。

glLayer.opaque = NO;      
glLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
于 2012-09-10T06:57:41.937 回答