I have tested the same (It should be get the same results I think) structure with cocos2d-x (C++) and cocos2d (Objective C) and I get different results (images attached). The code using cocos2d-x (C++) is this:
CCSprite first = CCSprite::spriteWithFile;
first~~>setPosition);
CCSprite second = CCSprite::spriteWithFile;
second~~>setPosition);
CCSprite third = CCSprite::spriteWithFile;
third->setPosition);
CCSpriteall = new CCSprite;
all~~>addChild;
all~~>addChild;
all~~>addChild;
CCLayerColor layer = CCLayerColor::layerWithColor);
layer~~>getCamera~~>setCenterXYZ;
layer~~>getCamera~~>setEyeXYZ;
layer~~>getCamera~~>setUpXYZ;
layer~~>addChild;
this->addChild;
The code using cocos2d is this:
CCSpritefirst = [CCSprite spriteWithFile:`“square.png”];
[first setPosition:ccp(150.0f, 450.0f)];
CCSprite *second = [CCSprite spriteWithFile:`“square.png”];
[second setPosition:ccp(150.0f, 250.0f)];
CCSprite third = ;
;
CCSpriteall = [[CCSprite alloc] init];
[all addChild:first];
[all addChild:second];
[all addChild:third];
CCLayerColor* layer = [CCLayerColor layerWithColor:ccc4(255, 0, 255, 255)];
[[layer camera] setCenterX:0.0f centerY:45.0f centerZ:90.0f];
[[layer camera] setEyeX:0.0f eyeY:0.0f eyeZ:0.0f];
[[layer camera] setUpX:0.0f upY:1.0f upZ:0.0f];
[layer addChild:all];
[self addChild:layer];
I know that the camera use the gluLookAt function from OpenGL, maybe is here the problem?
cocos2d-x.png (117.6 KB)
cocos2d.png (130.5 KB)