我正在使用 cocos2d 2.0。在一个场景中,我在 tableview 中加载数据时出现错误提示 日志窗口中的“-[CCSprite draw] 530 中的 OpenGL 错误 0x0502”。 应用运行良好
我搜索了一下,发现缺少一些着色器文件。我已确保我所有的文件都在那里并且编译源也是最新的。
但是在链接上我得到了一些解决方案 saying 好吧,我不知道要修改哪个绘图函数以及我的 cocos2d 文件有什么问题。 有什么办法可以解决这个问题吗?这会让我的应用程序在未来崩溃吗?
我的代码:
-(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;
}
最佳答案
Cocos2d 2.0 使用OpenGLES2.0,所以不要使用OpenGL immediate mode cocos2d 2.0 中的 API。
例如:GLBegin()、GLLineWidth()、glDrawArrays()等
关于ios - -[CCSprite draw] 530 中的 OpenGL 错误 0x0502,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15632690/