在Cocos2d 2.0迁移之后,精灵放置都是错误的

时间:2021-09-29 18:54:52

I've just updated my project to Cocos2d v2.0 and after getting rid of all build errors, i can get it to run but the game seems to draw things in the wrong place. Buttons/menus are clickable where they're supposed to be, but the sprites show up in the wrong place, or not at all. (This project was my copying old files into a new v2.0 project from a template.)

我刚刚将我的项目更新到Cocos2d v2.0,在摆脱了所有构建错误之后,我可以让它运行但游戏似乎把事情搞错了。按钮/菜单是可以点击的,但是精灵出现在错误的地方,或者根本不出现。 (这个项目是我从模板中将旧文件复制到一个新的v2.0项目中。)

I'm also getting openGL errors like this

我也得到像这样的openGL错误

OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0502 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCTextureAtlas drawNumberOfQuads:fromIndex:] 556

So, I reread the migration post... removed the RootViewController stuff, etc, then created a new project from the v2.0 template and made my appDelegate look just like it. I double checked my CCSprite -draw method, looks just like it's supposed to in v2.0

所以,我重新阅读了迁移帖子...删除了RootViewController的东西等,然后从v2.0模板创建了一个新项目,让我的appDelegate看起来就像它一样。我仔细检查了我的CCSprite -draw方法,看起来就像它应该在v2.0中一样

No change. Still OpenGL errors and most of my sprites are out of place. (background seem fine, oddly enough.)

没变。仍然OpenGL错误和我的大多数精灵都不合适。 (背景似乎很好,奇怪的是。)

This is happening when using the 5.1 or 6.0b4 IOS Simulator

使用5.1或6.0b4 IOS模拟器时会发生这种情况

I'm at a loss.. :(

我很茫然...... :(

Anyone have any ideas? I've exhausted my search options and am just frustrated .. thanks ahead of time!

有人有主意吗?我已经用尽了我的搜索选项,我只是感到沮丧...提前谢谢!

(FYI, this was a fully working v1.0.1 game)

(仅供参考,这是一款完全正常运行的v1.0.1游戏)

UPDATE: SUCCESS!!! So, I had a third part class (SWScrollView .h and CCNode+Autolayout.h) that was using glPushMatrix() and glPopMatrix()

更新:成功!所以,我有一个使用glPushMatrix()和glPopMatrix()的第三部分类(SWScrollView .h和CCNode + Autolayout.h)

updating those to kmGLPushMatrix() and kmGLPopMatrix() fixed all of the errors and sprite placement!!!

更新那些到kmGLPushMatrix()和kmGLPopMatrix()修复了所有的错误和精灵位置!

1 个解决方案

#1


0  

Cocos2D 2.0 uses OpenGLES2.0 but cocos2D 1.0 uses OpenGLES1.0.

Cocos2D 2.0使用OpenGLES2.0,但cocos2D 1.0使用OpenGLES1.0。

Here is one similar thread, follow my answer. Replace ur draw function.

这是一个类似的主题,请按照我的回答。替换你的绘图功能。

#1


0  

Cocos2D 2.0 uses OpenGLES2.0 but cocos2D 1.0 uses OpenGLES1.0.

Cocos2D 2.0使用OpenGLES2.0,但cocos2D 1.0使用OpenGLES1.0。

Here is one similar thread, follow my answer. Replace ur draw function.

这是一个类似的主题,请按照我的回答。替换你的绘图功能。