Cocos2D 2.0 - Zillions of OpenGL errors

前端 未结 1 1706
清酒与你
清酒与你 2020-11-30 08:25

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

相关标签:
1条回答
  • 2020-11-30 08:57

    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

    0 讨论(0)
提交回复
热议问题