我应该如何使透明的cocos3D场景(透明背景的EAGLView)?我知道这将是一个重复的问题。 但我已经尝试了各种来源的所有建议,但其中没有人为我工作。带透明背景的EAGLView?
刚上市他们在这里作为参考:
1)改变了不透明和透明色在setGLDefaultValues方法CCDirector.m
openGLView_.opaque = NO;
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
2)在EAGLView的initWithCoder
CAEAGLLayer *eaglLayer = (CAEAGLLayer*)[self layer];
pixelformat_ = kEAGLColorFormatRGBA8;
depthFormat_ = 0; // GL_DEPTH_COMPONENT24_OES;
multiSampling_= NO;
requestedSamples_ = 0;
size_ = [eaglLayer bounds].size;
eaglLayer.opaque = NO;
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
const CGFloat myColor[] = {0.0, 0.0, 0.0, 0.0};
eaglLayer.backgroundColor = CGColorCreate(rgb, myColor);
CGColorSpaceRelease(rgb);
eaglLayer.drawableProperties = eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
if(! [self setupSurfaceWithSharegroup:nil]) {
[self release];
return nil;
}
3)更改了我的CCViewController的isOverlayingDeviceCamera方法
viewController.isOverlayingDeviceCamera = YES;
我使用EAGLView.h 1.3版 我试图用新的版本(1.7),但我无法继续,因为它使编译器错误这种进口
#import <OpenGL/OpenGL.h>
请给我一只手,因为我浪费了我整整一天解决此
我曾在setGLDefaultValues中试过。但不起作用。我应该使用更新版本的EAGLView类而不是版本1.3吗? – sajaz
更新:我试过openGLView_.backgroundColor = [UIColor redColor];然后显示红色背景,突然变成黑色 – sajaz