CCRenderTexture iPhone 4性能(cocos2d v2 / box2d)

时间:2014-07-25 08:05:41

标签: ios iphone performance cocos2d-iphone box2d

我的屏幕上有2xCCRenderTextures渲染我的蝙蝠侠。在iPhone 4s / 5 / 5s游戏上工作得很好,但是如果我在iphone 4上添加一个或两个rendertextures fps将是30并且它没有绘制任何东西(绘制它的20个)!哪里有问题? iPhone 4只是为此慢,或者我可以改变什么?也许一些优化?任何帮助。

我的RenderTexture代码:

 renderTexture = [CCRenderTexture renderTextureWithWidth:winSize.width height:winSize.height];

renderTexture.sprite.shaderProgram = [[CCGLProgram alloc] initWithVertexShaderByteArray:ccPositionTextureA8Color_vert
                                                                fragmentShaderByteArray:ccPositionTextureColorAlphaTest_frag];
[renderTexture.sprite.shaderProgram addAttribute:kCCAttributeNamePosition index:kCCVertexAttrib_Position];
[renderTexture.sprite.shaderProgram addAttribute:kCCAttributeNameColor index:kCCVertexAttrib_Color];
[renderTexture.sprite.shaderProgram addAttribute:kCCAttributeNameTexCoord index:kCCVertexAttrib_TexCoords];
[renderTexture.sprite.shaderProgram link];
[renderTexture.sprite.shaderProgram updateUniforms];

alphaValueLocation = 4; //4
renderTexture.sprite.position = ccp(0, 0);
renderTexture.sprite.anchorPoint = ccp(0, 1);

[renderTexture.sprite.shaderProgram setUniformLocation:alphaValueLocation withF1:0.8f];
[renderTexture.sprite.shaderProgram use];
 [self addChild:renderTexture z:2];

0 个答案:

没有答案