0

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.)

I'm also getting openGL errors like this

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

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

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

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)

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

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

  • If you solve your question, please post the answer as an 'answer' instead of editing it into the original question. This lets you get upvotes for your answer as well as helping with the site's bookkeeping. Thanks. – Tim Aug 22 '12 at 14:55

1 Answers1

0

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

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

Community
  • 1
  • 1
Guru
  • 21,652
  • 10
  • 63
  • 102