Cocos2D 2.0 - 数以百万计的OpenGL错误 [英] Cocos2D 2.0 - Zillions of OpenGL errors
问题描述
我将Cocos2D项目转换为2.0。
我使用Cocos2D 2.0模板(无物理的简单模板)创建了一个空白项目,
我编译,我看到了没有错误。我运行应用程序,它似乎正确运行,但我有控制台上的这些错误...
MyApp [1266: 707] cocos2d:动画停止
MyApp [1266:707] cocos2d:动画以帧间隔开始:60.00
MyApp [1266:707] cocos2d:surface size:640x960
MyApp [1266:707 ] cocos2d:表面大小:640x960
MyApp [1266:707] cocos2d:动画停止
MyApp [1266:707] cocos2d:动画以帧间隔开始:60.00
MyApp [1266:707]失败调用上下文
MyApp [1266:707] cocos2d:表面大小:640x960
MyApp [1266:707]无法使完整的framebuffer对象0x8CDD
OpenGL错误0x0506 - [CCSprite draw] 532
OpenGL错误0x0502在 - [CCGLView swapBuffers] 280
MyApp [1266:707]未能调用上下文
MyApp [1266:707] cocos2d:表面大小:640x960
MyApp [1266:707]无法使完整的帧缓冲对象0x8CDD
OpenGL错误0x0506在 - [CCSprite draw] 532
OpenGL错误0x0502在 - [CCGLView swapBuffers] 280
OpenGL错误0x0506在 - CCFLrite swapBuffers] 280
OpenGL错误0x0502 in - [CCGLView swapBuffers] 280
OpenGL错误0x0506在 - [CCSprite draw] 532
OpenGL错误0x0502在 - [CCGLView swapBuffers] 280
OpenGL错误0x0506 in - [CCSprite draw] 532
OpenGL错误0x0502在 - [CCGLView swapBuffers] 280
OpenGL错误0x0506在 - [CCSprite draw] 532
OpenGL错误0x0502在 - [CCGLView swapBuffers ] 280
正如我所说,这是从一个空白模板创建的。
如何解决这个问题?
OpenGL错误0x506 = GL_INVALID_FRAMEBUFFER_OPERATION
Cocos2D 2.0和Cocos2D 1.0之间的主要区别是OpenGLES版本。 Cocos2D 2.0使用OpenGLES 2.0,Cocos2D 1.0使用OpenGLES 1.0。
我想你可以使用在OpenGLES 1.0中找不到的API。
示例:GLBegin(),GLLineWidth()等
使用此绘制函数:
- (void)draw
{
[super draw];
ccGLEnableVertexAttribs(kCCVertexAttribFlag_Position);
kmGLPushMatrix();
self.world-> DrawDebugData();
kmGLPopMatrix();
}
而不是这样:
- (void)draw
{
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
world-> DrawDebugData();
//恢复默认GL状态
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_ColOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
也可以使用GLES-Render.h和GLES-Render。 m从Cocos2D 2.0
I am transposing a Cocos2D project to 2.0.
I have created a blank project using Cocos2D 2.0 template (the simple template without physics) and transferred all files from the old project to the blank project.
I have also converted that to ARC.
I compile and I see no errors. I run the app and it appears to be running correctly, but I have these errors on console...
MyApp[1266:707] cocos2d: animation stopped
MyApp[1266:707] cocos2d: animation started with frame interval: 60.00
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] cocos2d: animation stopped
MyApp[1266:707] cocos2d: animation started with frame interval: 60.00
MyApp[1266:707] failed to call context
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] Failed to make complete framebuffer object 0x8CDD
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
MyApp[1266:707] failed to call context
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] Failed to make complete framebuffer object 0x8CDD
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
As I said, this was created from a blank template.
how do I fix that?
OpenGL error 0x506 = GL_INVALID_FRAMEBUFFER_OPERATION
Main difference between Cocos2D 2.0 and Cocos2D 1.0 is OpenGLES version. Cocos2D 2.0 uses OpenGLES 2.0 and Cocos2D 1.0 uses OpenGLES 1.0.
I guess you may used API that is not found in OpenGLES2.0 that found in OpenGLES 1.0
Example:GLBegin(), GLLineWidth() etc
Use this draw function:
-(void) draw
{
[super draw];
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
self.world->DrawDebugData();
kmGLPopMatrix();
}
Instead of this:
-(void) draw
{
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
world->DrawDebugData();
// restore default GL states
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
Also use GLES-Render.h and GLES-Render.m from Cocos2D 2.0
这篇关于Cocos2D 2.0 - 数以百万计的OpenGL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!