简体   繁体   English

在iPhone上与Apple UI进行Alpha混合

[英]Alpha Blending With Apple UI on iPhone

I am trying to place an OpenGL view on top of a standard UIView with a UIImageView. 我试图将OpenGL视图放在带有UIImageView的标准UIView上。 When I draw anything into the OpenGL view, I see slight alpha blending issues that result in the white lines seen below: 当我在OpenGL视图中绘制任何内容时,会看到轻微的alpha混合问题,导致出现以下白线: 白色Alpha混合

CCDirector *director = [CCDirector sharedDirector];
EAGLView *glView = [EAGLView viewWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)
                               pixelFormat:kEAGLColorFormatRGBA8    // kEAGLColorFormatRGBA8
                               depthFormat:0                        // GL_DEPTH_COMPONENT16_OES
                    ];
[glView setMultipleTouchEnabled:YES];

[director setOpenGLView:glView];

if(![director enableRetinaDisplay:YES]) NSLog(@"Retina Display Not supported");
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
[director setAnimationInterval:1.0/60];

[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];

[[CCDirector sharedDirector] runWithScene:[PPAvatarEditorScene scene]];
[[CCDirector sharedDirector] resume];
[glView setOpaque:NO];
[avatarImage addSubview:glView];

I am using Cocos2D to draw into the OpenGL view. 我正在使用Cocos2D绘制到OpenGL视图中。 Is there an issue with the Alpha Pixel Format or Texture Format? Alpha像素格式或纹理格式是否存在问题?

尝试将glClearColor设置为黑色:

glClearColor(0, 0, 0, 0);

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

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