OpenGL error 0x0502 in -[CCSprite draw] 530(OpenGL 错误 0x0502 在 -[CCSprite draw] 530)
问题描述
我正在使用 cocos2d 2.0.在一个场景中,我在 tableview 中加载数据时出现错误提示日志窗口中的OpenGL 错误 0x0502 in -[CCSprite draw] 530".应用运行良好
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.
但在链接上我得到了一些解决方案说好吧,我不知道要修改哪个绘图函数以及我的 cocos2d 文件有什么问题.有没有办法解决这个问题?这会在将来让我的应用崩溃吗?
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?
我的代码:
-(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 立即模式 cocos2d 2.0 中的api.
Cocos2d 2.0 uses OpenGLES2.0, so do not use OpenGL immediate mode api in cocos2d 2.0.
示例:GLBegin()、GLLineWidth()、glDrawArrays() 等
Example:GLBegin(), GLLineWidth(), glDrawArrays() etc.
这篇关于OpenGL 错误 0x0502 在 -[CCSprite draw] 530的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:OpenGL 错误 0x0502 在 -[CCSprite draw] 530
基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
