我在CCNode中使用openGL命令绘制一些Shape。现在我想用高斯模糊处理它。 但我找不到任何方法来做到这一点。 有人推荐吗?
。解决代码的主要原因:
CCRenderTexture *renderTex = [[CCRenderTexture renderTextureWithWidth:480 height: 320] retain];
renderTex.position = ccp(size.width/2, size.height/2);
[renderTex begin];
//here can put any draw code with opengl
[curve visit];
[renderTex end];
CCTexture2DMutable *mutableTexture=[[[CCTexture2DMutable alloc]
initWithImage:[renderTex getUIImageFromBuffer]]autorelease];
CGRect rect = CGRectMake(0, 0, [mutableTexture contentSizeInPixels].width, [mutableTexture contentSizeInPixels].height);
[AWTextureFilter blur:mutableTexture radius:8 rect:rect];
CCSpriteFrame *frame = [CCSpriteFrame frameWithTexture:mutableTexture rect:rect];
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFrame:frame name:@"1"];
CCSprite *blur = [CCSprite spriteWithSpriteFrame:frame];
[blur setPosition:ccp(size.width/2, size.height/2)];
blur.opacity=200;
[self addChild:blur];
答案 0 :(得分:1)
你必须:
一些信息: