rotating CCSprite in 3d

rotating CCSprite in 3d
0.0 0


I’m using cocos2d-2.1rc0-x-2.1.3
I’d like to make a sprite that is rotated along z (real 3d not skewed). It will be a flag with an animation CCWave3d.
I thought to subclass CCNode and overload the tranform() method.
(I’m wondering if it is the best solution)
however I was stopped soon by this error:

CNode3d.obj : error LNK2019: external symbol not resolved "void __cdecl cocos2d::CGAffineToGL(struct cocos2d::CCAffineTransform const *,float *)"

to fix that i copied the code inside the TransformUtils.h in the file CCNode3d.cpp (however I’d like to know how to fix better this, because I’ll encounter more than once!)

In any case, I have added a CCSprite to the CCNode3d and it is not rotated, not only, transform is not called at all!
Im I missing something?


#pragma once
#include "cocos2d.h"
using namespace cocos2d;

class CCNode3d : public CCNode
    float _angleY;
    void transform();


#include "CNode3d.h"
#include "support/TransformUtils.h"

#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))



void CCNode3d::transform(){
        kmMat4 transfrom4x4;

    // Convert 3x3 into 4x4 matrix
    CCAffineTransform tmpAffine = this->nodeToParentTransform();
    CGAffineToGL(&tmpAffine, transfrom4x4.mat);

    // Update Z vertex manually
    transfrom4x4.mat[14] = m_fVertexZ;

    kmGLMultMatrix( &transfrom4x4 );
    //kmGLRotatef(30,1,0,0);<<<<<<<<<<<<---basically i want to add this row (correct?)

    // XXX: Expensive calls. Camera should be integrated into the cached affine matrix
    if ( m_pCamera != NULL && !(m_pGrid != NULL && m_pGrid->isActive()) )
        bool translate = (m_obAnchorPointInPoints.x != 0.0f || m_obAnchorPointInPoints.y != 0.0f);

        if( translate )
            kmGLTranslatef(RENDER_IN_SUBPIXEL(m_obAnchorPointInPoints.x), RENDER_IN_SUBPIXEL(m_obAnchorPointInPoints.y), 0 );


        if( translate )
            kmGLTranslatef(RENDER_IN_SUBPIXEL(-m_obAnchorPointInPoints.x), RENDER_IN_SUBPIXEL(-m_obAnchorPointInPoints.y), 0 );


any ideas? (it is not enough to #include “support/TransformUtils.h”?)


the same issue when I called CGAffineToGL, in VS2010 and I can’t pass link.