本文内容来自网络,连接:http://www.techpot.net/archives/33453
注意两点就行了:
一个就是:
1。CCRenderTexture在初始化的时候高度和宽度不能小于1(这是模拟器的要求)
报错之后的表现为:
虽然画面卡住(就如同opengles罢工不做渲染了一样),但程序依然能够正常执行,box2d引擎工作也很正常(通过控制台输出进行检查)~
满足了上述的要求,程序能够很好的运行在模拟器里面~
但是,在模拟器里面能很好的运行不代表也能在设备里面很好的运行~
就如同之前的音频播放一样,在模拟器和真机上这两者是有区别的,那就是:
2。CCRenderTexture的高度和宽度在设备里面一定不能小于 32(详见如下提供的资料)
3。CCRenderTexture的高度和宽度不能大于 1024 (Added By BruceYang on 2012.01.10.15.23)~
报错之后的表现为:
这会程序算是真正的死掉了(因为我没划过屏幕一下就会播放一段声音,在模拟器里面画面卡住声音还在,真机里面声音也不在了)~
资料转载自:http://code.google.com/p/cocos2d-iphone/issues/detail?id=1187
Issue 1187: | Error initializing RenderTexture with specific sizes 2 people starred this issue and may be notified of changes. |
What steps will reproduce the problem?Create a RenderTexture with size 8-32 : CCRenderTexture *t = [CCRenderTexture renderTextureWithWidth:8 height:32]; What is the expected output? What do you see instead?It should work but it gives the following error on the iPad device : *** Terminating app due to uncaught exception 'Render Texture', reason: 'Could not attach texture to framebuffer'What cocos2d version are you using ?v1.0.0-rc2What iOS / Mac SDK are you using ?iOS 4.2.1 and 4.3.3Debug or Release ?debug and releaseWhich target device / target OS are you using ?iPad iOS 4.2.1 and 4.3.3iOS only: Does this happens on device ? or on the simulator ? or on both ?Only on the device.Please provide any additional information below.The same error happens with other sizes, like 2 - 8.When catching the error, the openGL state is not correct. Adding the following line before raising the exception would allow to continue running the application :ccglBindFramebuffer(CC_GL_FRAMEBUFFER, oldFBO_);
Comment 1 by project member marcotil…@gmail.com,
May 27, 2011