我在 CCNode 中使用 openGL 命令绘制了一些形状。现在我想用它处理高斯模糊。但我找不到任何方法来做到这一点。有人推荐吗?
.
.major 解决代码:
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];