1

I am using cocos2d 2.0. Here on one scene where i load data in tableview i get error saying "OpenGL error 0x0502 in -[CCSprite draw] 530" in log window. App runs well

I searched and i realised there are some shader files missing. I have made sure all my files are there and compile sources are also up to date.

But on on link i got some solution saying Well I don't know which draw function to modify and whats wrong with my cocos2d files. Is there any way to solve this issue? Can this crash my app in the future?

My Code:

    -(id) init
    {

if( (self=[super init] )) {

    CGSize winSize = [CCDirector sharedDirector].winSize;
    tableView = [SWTableView viewWithDataSource:self size:winSize];

    tableView.direction = SWScrollViewDirectionVertical;
    tableView.position = ccp(0,0);
    tableView.delegate = self;
    tableView.verticalFillOrder = SWTableViewFillTopDown;
     [self addChild:tableView];
     }
     return self;
     }

    -(SWTableViewCell *)table:(SWTableView *)table cellAtIndex:(NSUInteger)idx {


     SWTableViewCell *cell = [table dequeueCell];
     if (!cell) {
     cell = [[MyCell new] autorelease];
     }

    CCMenuItemImage * listItemBtn =[CCMenuItemImage itemWithNormalImage:@"        listitem.png" selectedImage:@"listitem_sel.png" ];

     listItemBtn.position=ccp(270, 20);
     [cell addChild:listItemBtn];

     return cell;

     }
Community
  • 1
  • 1
xrnd
  • 1,273
  • 3
  • 21
  • 38

1 Answers1

1

Cocos2d 2.0 uses OpenGLES2.0, so do not use OpenGL immediate mode api in cocos2d 2.0.

Example:GLBegin(), GLLineWidth(), glDrawArrays() etc.

Community
  • 1
  • 1
Guru
  • 21,652
  • 10
  • 63
  • 102
  • Hi, Thanx for your answer. actually I am really new to cocos2d and I have no idea how to solve this issue. Can u suggest me some example or some post where they have explained alternative for Immediate mode. – xrnd Mar 27 '13 at 11:35
  • first find out which openGL api giving this log. Debug you code..then you can find alternative...without knowing API ..how can u find solution ! – Guru Mar 27 '13 at 11:44
  • Ok,Basically I am using another api for showing table view in cocos2d.[link](https://www.dropbox.com/s/p823vls3f4eota2/SWCategory.zip) and this is my cocos2d api [link](https://www.dropbox.com/s/fbhxpfwwcbox2gv/Archive.zip). The errors occur when the table view cell is returned. I have added my code now. The errors occur after return cell in CellAtIndex Function, till then there are no errors. Also, while i was debugging there was no error for each individual cell but they all appear together after the scene is visible.And again and again when i scroll. – xrnd Mar 27 '13 at 13:27
  • I didn't use tabelview in cocos2d game...wait for few days.some expert may give right answer for you. – Guru Mar 27 '13 at 17:48
  • Well Ok, meanwhile I will also look for the solution. – xrnd Mar 27 '13 at 18:55