Page 1 of 1

Loader for Cocos2D v3 iphone

Posted: Thu Aug 13, 2015 12:52 pm
by superGuy
Hello guys,
first of all thanks for rube editor, rube is amazing tool and I've used it in most of my physics based games.
At the moment I'm trying to make another game with rube and Cocos2D v3 + Spritebuilder, but I'm faced into problem. The problem is that the scene loader you provide with rube sample codes is not suitable for cocos2D v3, as there are some changes in cocos2D and cocos2D v3 uses OpenGLES 2.0. I made some changes in BasicRubeLayer file but there is still needs some changes in draw function related to opengles.

The code is not compiling because
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
are not exists in Cocos2D v3.

I hope you will help me with this part.
Thanks in advance.

Re: Loader for Cocos2D v3 iphone

Posted: Thu Aug 13, 2015 2:26 pm
by iforce2d
What sample are you basing your work on? On the sample loaders page ( there are loaders for Cocos2d-X V3 and Cocos2d-X V3.4.

ah, sorry, you are talking about the non-X cocos2d.

In that case, perhaps the source code for the X versions might have the some usable code? They needed those same changes you point out.

Re: Loader for Cocos2D v3 iphone

Posted: Thu Aug 13, 2015 2:40 pm
by superGuy
I have look into cocos x version code, and there are also
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );

I've changed
-(void) draw
-(void)draw:(CCRenderer *)renderer transform:(const GLKMatrix4 *)transform

and replaced CCLAyer with CCNode as the CCLAyer class is removed from the new cocos2D

now i want to see the result of debug draw for debug draw previous loader uses pushmatrix and popmatrix with
but in cocos2d iphone v3 there is no pushmatrix, popmatrix and ccGLEnableVertexAttribs. I'm not so good on opengl es, maybe it is realted with opengles and not Loader?


It appears that i had to change Gles-renderer for DebugDraw, and also I've commented the gl functions which are not exists and it starts working.