Cocos2D CCRenderTexture莫名其妙报错的问题

本文内容来自网络,连接: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.

Reported by  boidin.c…@gmail.comMay 24, 2011
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.comMay 27, 2011
The minimum size of a render texture is 32 pixels, the minimum size for a FBO. It's a apple limitation/bug. More information about this can be found on the apple dev forums. If you want the application to continue, you could change the NSException into a NSAssert. Adding that line would make the check obsolete, since it binds the frame buffer of the screen and not the just created one of the render texture. The screen FBO will be tested that way instead of the one from the render texture. I've changed the status to wontfix, since this isn't a cocos bug. If you think I'm mistaken or have a work-around / solution for this, the issue can always be reopened. 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值