CCNode-visit-function 复制了 CCSprite 有暗边
我有一个关于CCNode的[访问]功能的问题
原图很好,轮廓清晰,没什么特别的,里面是由5个叶子精灵组成。
屏幕截图:
然后我想使用 [访问CCNode]复制它。
这是代码
-(CCSprite *)flattenSprite:(CCSprite*)sprite textureSize:(float)textureSize {
CCRenderTexture *rt = [CCRenderTexture renderTextureWithWidth:textureSize height:textureSize];
[rt begin];
// store the original sprite position
CGPoint p=sprite.position;
//set original sprite to a target point for open GL to "visit"
sprite.position=ccp(textureSize/2,textureSize/2);
// open GL visit
[sprite visit];
//original sprite return to original point
sprite.position=p;
[rt end];
return [CCSprite spriteWithTexture:rt.sprite.texture];
}
通过这个函数,我可以通过限制舞台上存在的精灵数量来优化应用程序的性能,但“复制的精灵”周围有一个黑暗的边缘。它看起来很奇怪 - 特别是当精灵彼此重叠时。
请告诉我您是否有任何线索/在任何地方获得有关此黑暗边缘问题的有用信息
I've got a question about the [visit] function of CCNode
The original image is good with clear outline, nothing special, it composes of 5 leaves sprites inside.
SCREEN CAPTURE :
Then I want to use [CCNode visit] to copy it.
And here's the code
-(CCSprite *)flattenSprite:(CCSprite*)sprite textureSize:(float)textureSize {
CCRenderTexture *rt = [CCRenderTexture renderTextureWithWidth:textureSize height:textureSize];
[rt begin];
// store the original sprite position
CGPoint p=sprite.position;
//set original sprite to a target point for open GL to "visit"
sprite.position=ccp(textureSize/2,textureSize/2);
// open GL visit
[sprite visit];
//original sprite return to original point
sprite.position=p;
[rt end];
return [CCSprite spriteWithTexture:rt.sprite.texture];
}
By this function I can optimize the performance of the application by limiting the amount of the sprites existing on stage but the "copied sprites" got a dark edge around it. It looks weird - especially when the sprites are overlapping each others.
Please tell me if you have any clues / anywhere got useful information about this dark edge issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)