Loader for Cocos2D v3 iphone

What would you like to see in future versions of the editor?
Post Reply
superGuy
Posts: 3
Joined: Thu Aug 13, 2015 12:41 pm

Loader for Cocos2D v3 iphone

Post 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 );
kmGLPushMatrix();
kmGLPopMatrix();
are not exists in Cocos2D v3.

I hope you will help me with this part.
Thanks in advance.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Loader for Cocos2D v3 iphone

Post by iforce2d »

What sample are you basing your work on? On the sample loaders page (https://www.iforce2d.net/rube/?panel=loaders) 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.
superGuy
Posts: 3
Joined: Thu Aug 13, 2015 12:41 pm

Re: Loader for Cocos2D v3 iphone

Post by superGuy »

I have look into cocos x version code, and there are also
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
kmGLPopMatrix();


I've changed
-(void) draw
to
-(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
ccGLEnableVertexAttribs.
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?


**EDIT**

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.
Post Reply