我有一个使用Cocos2d的iPhone应用程序(版本:#define COCOS2D_VERSION 0x00010000
)。它可以在我的iPad和iPhone以及我测试过的各种iPhone上正常工作。
但是在一个(3G)上,每次初始化期间它总是崩溃-崩溃日志在CCSprite.m
方法的-draw
文件中显示了问题-在此行:
// tex coords
diff = offsetof( ccV3F_C4B_T2F, texCoords);
glTexCoordPointer(2, GL_FLOAT, kQuadSize, (void*)(offset + diff)); // This line crashes
崩溃日志显示以下内容:
OS Version: iPhone OS 4.2.1 (8C148)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000004
Crashed Thread: 0
Thread 0 Crashed:
0 MBXGLEngine 0x302554e8 0x30229000 + 181480
1 MBXGLEngine 0x30256980 0x30229000 + 186752
2 MBXGLEngine 0x3022ca80 0x30229000 + 14976
3 MBXGLEngine 0x30252580 0x30229000 + 169344
4 S100 0x000342d8 -[CCSprite draw] (CCSprite.m:606)
5 S100 0x00023e74 -[CCNode visit] (CCNode.m:550)
6 S100 0x00023e14 -[CCNode visit] (CCNode.m:535)
7 S100 0x00023e50 -[CCNode visit] (CCNode.m:545)
8 S100 0x00048500 -[CCDirectorIOS drawScene] (CCDirectorIOS.m:169)
9 Foundation 0x35168eda 0x35151000 + 98010
10 Foundation 0x35168d5e 0x35151000 + 97630
11 S100 0x0004ad38 -[EAGLView layoutSubviews] (EAGLView.m:214)
最佳答案
纹理的大小是多少?在较旧的设备上,其大小不能超过1024x1024。
关于iphone - CCSprite的-draw方法启动时发生奇怪的崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5549841/